brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [06/50] brooklyn-library git commit: allow server options to be specified for MySQL, including a convenience for lower_case_table_names
Date Mon, 01 Feb 2016 17:46:09 GMT
allow server options to be specified for MySQL, including a convenience for lower_case_table_names


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

Branch: refs/heads/0.4.0
Commit: 71c8f496c477224065352496086b77b702d7511d
Parents: 98c29a3
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Fri Sep 21 11:48:46 2012 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Mon Sep 24 08:31:39 2012 -0400

----------------------------------------------------------------------
 .../java/brooklyn/entity/database/mysql/MySqlNode.groovy    | 8 +++++---
 .../brooklyn/entity/database/mysql/MySqlSshDriver.groovy    | 9 +++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/71c8f496/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNode.groovy
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNode.groovy
b/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNode.groovy
index e287b73..99d53dc 100644
--- a/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNode.groovy
+++ b/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlNode.groovy
@@ -1,14 +1,13 @@
 package brooklyn.entity.database.mysql
 
+import brooklyn.config.ConfigKey
 import brooklyn.entity.Entity
 import brooklyn.entity.basic.SoftwareProcessEntity
-
 import brooklyn.event.basic.BasicAttributeSensor
 import brooklyn.event.basic.BasicConfigKey
+import brooklyn.event.basic.MapConfigKey
 import brooklyn.event.basic.PortAttributeSensorAndConfigKey
-
 import brooklyn.location.basic.PortRanges
-
 import brooklyn.util.flags.SetFromFlag
 
 public class MySqlNode extends SoftwareProcessEntity {
@@ -25,6 +24,9 @@ public class MySqlNode extends SoftwareProcessEntity {
 
     @SetFromFlag("creationScriptUrl")
     public static final BasicConfigKey<String> CREATION_SCRIPT_URL = [ String, "mysql.creation.script.url",
"URL where MySQL creation script can be found", "" ]
+
+    public static final MapConfigKey<String> MYSQL_SERVER_CONF = [ Object, "mysql.server.conf",
"Configuration options for mysqld" ]
+    public static final ConfigKey<Object> MYSQL_SERVER_CONF_LOWER_CASE_TABLE_NAMES
= MYSQL_SERVER_CONF.subKey("lower_case_table_names", "See MySQL guide. Set 1 to ignore case
in table names (useful for OS portability)");
     
     /** download mirror, if desired; defaults to Austria which seems one of the fastest */
 	@SetFromFlag("mirrorUrl")

http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/71c8f496/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlSshDriver.groovy
----------------------------------------------------------------------
diff --git a/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlSshDriver.groovy
b/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlSshDriver.groovy
index 81c8001..1e84b67 100644
--- a/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlSshDriver.groovy
+++ b/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlSshDriver.groovy
@@ -107,6 +107,7 @@ port            = ${port}
 socket          = /tmp/mysql.sock.${socketUid}.${port}
 basedir         = ${basedir}
 datadir         = .
+"""+getMySqlServerOptionsString()+"""
 
 """+"END_MYSQL_CONF_${entity.id}\n",
                 "${basedir}/scripts/mysql_install_db "+
@@ -124,6 +125,14 @@ datadir         = .
                 "kill \$MYSQL_PID"
             ).execute();
     }
+    
+    protected String getMySqlServerOptionsString() {
+        Map options = entity.getConfig(MySqlNode.MYSQL_SERVER_CONF);
+        if (!options) return "";
+        String result = "";
+        options.each { k,v -> result += ""+k+" = "+v+"\n" }
+        return result;
+    }
 
     @Override
     public void launch() {


Mime
View raw message