brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/8] incubator-brooklyn git commit: WinRmDriver.copyTo: handle different url types
Date Wed, 23 Sep 2015 10:23:28 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 29954710c -> 93f6f0f6a


WinRmDriver.copyTo: handle different url types


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

Branch: refs/heads/master
Commit: b9d95a4dd88704a4d57f6fcd094e69968473205a
Parents: 874a3a8
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Sep 22 20:06:35 2015 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Wed Sep 23 01:32:48 2015 +0100

----------------------------------------------------------------------
 .../base/AbstractSoftwareProcessWinRmDriver.java    | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/b9d95a4d/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
index 7091147..f0d0725 100644
--- a/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
+++ b/software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
@@ -32,8 +32,10 @@ import org.apache.brooklyn.entity.software.base.lifecycle.NativeWindowsScriptRun
 import org.apache.brooklyn.entity.software.base.lifecycle.WinRmExecuteHelper;
 import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
 import org.apache.brooklyn.util.core.task.Tasks;
+import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.exceptions.ReferenceWithError;
 import org.apache.brooklyn.util.repeat.Repeater;
+import org.apache.brooklyn.util.stream.Streams;
 import org.apache.brooklyn.util.text.Strings;
 import org.apache.brooklyn.util.time.Duration;
 import org.python.core.PyException;
@@ -171,7 +173,19 @@ public abstract class AbstractSoftwareProcessWinRmDriver extends AbstractSoftwar
         if (createParentDir) {
             createDirectory(getDirectory(target), "Creating resource directory");
         }
-        return copyTo(new File(source), target);
+        
+        InputStream stream = null;
+        try {
+            Tasks.setBlockingDetails("retrieving resource "+source+" for copying across");
+            stream = resource.getResourceFromUrl(source);
+            Tasks.setBlockingDetails("copying resource "+source+" to server");
+            return copyTo(stream, target);
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        } finally {
+            Tasks.setBlockingDetails(null);
+            if (stream != null) Streams.closeQuietly(stream);
+        }
     }
 
     @Override


Mime
View raw message