brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [35/50] brooklyn-server git commit: Reads default install/run dir from brooklyn config
Date Mon, 01 Feb 2016 17:49:05 GMT
Reads default install/run dir from brooklyn config

- Rather than hard-coding in /tmp, allows default dirs
  to be set via brooklyn config (i.e. by system properties, etc)


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

Branch: refs/heads/0.4.0
Commit: 532ade84d2f92ff13d6a67809b940157b205d331
Parents: de3cb11
Author: Aled Sage <aled.sage@gmail.com>
Authored: Mon Oct 15 13:32:46 2012 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Tue Oct 16 22:20:59 2012 +0100

----------------------------------------------------------------------
 .../basic/AbstractSoftwareProcessSshDriver.java   | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/532ade84/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
index aff0db9..7e01478 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/AbstractSoftwareProcessSshDriver.java
@@ -32,7 +32,8 @@ public abstract class AbstractSoftwareProcessSshDriver extends AbstractSoftwareP
     public static final Logger logSsh = LoggerFactory.getLogger(BrooklynLogging.SSH_IO);
 
     public static final String BROOKLYN_HOME_DIR = "/tmp/brooklyn-"+System.getProperty("user.name");
-    public static final String DEFAULT_INSTALL_BASEDIR = BROOKLYN_HOME_DIR+"/"+"installs";
+    public static final String DEFAULT_INSTALL_BASEDIR = BROOKLYN_HOME_DIR+File.separator+"installs";
+    public static final String DEFAULT_RUN_BASEDIR = BROOKLYN_HOME_DIR+File.separator+"apps";
     public static final String NO_VERSION_INFO = "no-version-info";
 
     public AbstractSoftwareProcessSshDriver(EntityLocal entity, SshMachineLocation machine)
{
@@ -58,17 +59,28 @@ public abstract class AbstractSoftwareProcessSshDriver extends AbstractSoftwareP
     protected String getEntityVersionLabel() {
         return getEntityVersionLabel("_");
     }
+    
     protected String getEntityVersionLabel(String separator) {
         return elvis(entity.getClass().getSimpleName(),  
                 entity.getClass().getName())+(!NO_VERSION_INFO.equals(getVersion()) ? separator+getVersion()
: "");
     }
+    
     public String getInstallDir() {
+        String installBasedir = entity.getManagementContext().getConfig().getFirst("brooklyn.dirs.install");
+        if (installBasedir == null) installBasedir = DEFAULT_INSTALL_BASEDIR;
+        if (installBasedir.endsWith(File.separator)) installBasedir.substring(0, installBasedir.length()-1);
+        
         return elvis(entity.getConfig(SoftwareProcessEntity.SUGGESTED_INSTALL_DIR),
-                DEFAULT_INSTALL_BASEDIR+"/"+getEntityVersionLabel("/"));
+                installBasedir+"/"+getEntityVersionLabel("/"));
     }
+    
     public String getRunDir() {
+        String runBasedir = entity.getManagementContext().getConfig().getFirst("brooklyn.dirs.run");
+        if (runBasedir == null) runBasedir = DEFAULT_RUN_BASEDIR;
+        if (runBasedir.endsWith(File.separator)) runBasedir.substring(0, runBasedir.length()-1);
+        
         return elvis(entity.getConfig(SoftwareProcessEntity.SUGGESTED_RUN_DIR), 
-                BROOKLYN_HOME_DIR+"/"+"apps"+"/"+entity.getApplication().getId()+"/"+"entities"+"/"+
+                runBasedir+"/"+entity.getApplication().getId()+"/"+"entities"+"/"+
                 getEntityVersionLabel()+"_"+entity.getId());
     }
 


Mime
View raw message