brooklyn-software-database: add org.apache package prefix
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/ac1a7c09 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/ac1a7c09 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/ac1a7c09 Branch: refs/heads/master Commit: ac1a7c0947b33a71124ef4d56ed356a248db357d Parents: 5dfe944 Author: Ciprian Ciubotariu <[email protected]> Authored: Fri Aug 14 16:24:40 2015 +0300 Committer: Ciprian Ciubotariu <[email protected]> Committed: Tue Aug 18 12:33:38 2015 +0300 ---------------------------------------------------------------------- docs/guide/start/_my-web-cluster.yaml | 2 +- .../appserver-clustered-w-db-concise.yaml | 2 +- .../example_yaml/appserver-clustered-w-db.yaml | 2 +- .../appserver-w-db-other-flavor.yaml | 2 +- .../guide/yaml/example_yaml/appserver-w-db.yaml | 2 +- .../yaml/example_yaml/appserver-w-policy.yaml | 2 +- .../demo/WebClusterDatabaseExample.java | 2 +- .../demo/WebClusterDatabaseExampleApp.java | 2 +- ...lusterDatabaseExampleAppIntegrationTest.java | 2 +- .../postgresql/PostgreSqlNodeSaltImpl.java | 2 +- .../postgresql/PostgreSqlSaltLiveTest.java | 6 +- software/database/pom.xml | 18 +- .../brooklyn/entity/database/DatabaseNode.java | 29 -- .../entity/database/DatastoreMixins.java | 104 ---- .../entity/database/crate/CrateNode.java | 92 ---- .../entity/database/crate/CrateNodeDriver.java | 24 - .../entity/database/crate/CrateNodeImpl.java | 99 ---- .../database/crate/CrateNodeSshDriver.java | 118 ----- .../entity/database/mariadb/MariaDbDriver.java | 31 -- .../entity/database/mariadb/MariaDbNode.java | 100 ---- .../database/mariadb/MariaDbNodeImpl.java | 139 ----- .../database/mariadb/MariaDbSshDriver.java | 259 ---------- .../entity/database/mysql/MySqlCluster.java | 68 --- .../entity/database/mysql/MySqlClusterImpl.java | 445 ---------------- .../entity/database/mysql/MySqlDriver.java | 31 -- .../entity/database/mysql/MySqlNode.java | 97 ---- .../entity/database/mysql/MySqlNodeImpl.java | 167 ------ .../entity/database/mysql/MySqlRowParser.java | 39 -- .../entity/database/mysql/MySqlSshDriver.java | 279 ---------- .../database/postgresql/PostgreSqlDriver.java | 33 -- .../database/postgresql/PostgreSqlNode.java | 95 ---- .../PostgreSqlNodeChefImplFromScratch.java | 171 ------- .../database/postgresql/PostgreSqlNodeImpl.java | 85 --- .../database/postgresql/PostgreSqlSpecs.java | 43 -- .../postgresql/PostgreSqlSshDriver.java | 425 --------------- .../entity/database/rubyrep/RubyRepDriver.java | 28 - .../entity/database/rubyrep/RubyRepNode.java | 109 ---- .../database/rubyrep/RubyRepNodeImpl.java | 111 ---- .../database/rubyrep/RubyRepSshDriver.java | 126 ----- .../brooklyn/entity/database/DatabaseNode.java | 29 ++ .../entity/database/DatastoreMixins.java | 104 ++++ .../entity/database/crate/CrateNode.java | 92 ++++ .../entity/database/crate/CrateNodeDriver.java | 24 + .../entity/database/crate/CrateNodeImpl.java | 99 ++++ .../database/crate/CrateNodeSshDriver.java | 118 +++++ .../entity/database/mariadb/MariaDbDriver.java | 31 ++ .../entity/database/mariadb/MariaDbNode.java | 100 ++++ .../database/mariadb/MariaDbNodeImpl.java | 139 +++++ .../database/mariadb/MariaDbSshDriver.java | 259 ++++++++++ .../entity/database/mysql/MySqlCluster.java | 68 +++ .../entity/database/mysql/MySqlClusterImpl.java | 445 ++++++++++++++++ .../entity/database/mysql/MySqlDriver.java | 31 ++ .../entity/database/mysql/MySqlNode.java | 97 ++++ .../entity/database/mysql/MySqlNodeImpl.java | 167 ++++++ .../entity/database/mysql/MySqlRowParser.java | 39 ++ .../entity/database/mysql/MySqlSshDriver.java | 279 ++++++++++ .../database/postgresql/PostgreSqlDriver.java | 33 ++ .../database/postgresql/PostgreSqlNode.java | 95 ++++ .../PostgreSqlNodeChefImplFromScratch.java | 171 +++++++ .../database/postgresql/PostgreSqlNodeImpl.java | 85 +++ .../database/postgresql/PostgreSqlSpecs.java | 43 ++ .../postgresql/PostgreSqlSshDriver.java | 425 +++++++++++++++ .../entity/database/rubyrep/RubyRepDriver.java | 28 + .../entity/database/rubyrep/RubyRepNode.java | 109 ++++ .../database/rubyrep/RubyRepNodeImpl.java | 111 ++++ .../database/rubyrep/RubyRepSshDriver.java | 126 +++++ .../brooklyn/entity/database/crate/crate.yaml | 28 - .../brooklyn/entity/database/mariadb/my.cnf | 19 - .../entity/database/mssql/ConfigurationFile.ini | 390 -------------- .../entity/database/mssql/checkrunningmssql.bat | 23 - .../entity/database/mssql/configuremssql.ps1 | 22 - .../entity/database/mssql/installmssql.ps1 | 49 -- .../entity/database/mssql/launchmssql.bat | 25 - .../brooklyn/entity/database/mssql/mssql.yaml | 40 -- .../entity/database/mssql/stopmssql.bat | 24 - .../brooklyn/entity/database/mysql/mysql.conf | 19 - .../entity/database/mysql/mysql_master.conf | 26 - .../entity/database/mysql/mysql_slave.conf | 33 -- .../entity/database/postgresql/postgresql.conf | 513 ------------------- .../entity/database/rubyrep/rubyrep.conf | 28 - .../brooklyn/entity/database/crate/crate.yaml | 28 + .../brooklyn/entity/database/mariadb/my.cnf | 19 + .../entity/database/mssql/ConfigurationFile.ini | 390 ++++++++++++++ .../entity/database/mssql/checkrunningmssql.bat | 23 + .../entity/database/mssql/configuremssql.ps1 | 22 + .../entity/database/mssql/installmssql.ps1 | 49 ++ .../entity/database/mssql/launchmssql.bat | 25 + .../brooklyn/entity/database/mssql/mssql.yaml | 40 ++ .../entity/database/mssql/stopmssql.bat | 24 + .../brooklyn/entity/database/mysql/mysql.conf | 19 + .../entity/database/mysql/mysql_master.conf | 26 + .../entity/database/mysql/mysql_slave.conf | 33 ++ .../entity/database/postgresql/postgresql.conf | 513 +++++++++++++++++++ .../entity/database/rubyrep/rubyrep.conf | 28 + .../entity/database/VogellaExampleAccess.java | 161 ------ .../crate/CrateNodeIntegrationTest.java | 64 --- .../mariadb/MariaDbIntegrationTest.java | 127 ----- .../database/mariadb/MariaDbLiveEc2Test.java | 57 --- .../mariadb/MariaDbLiveRackspaceTest.java | 104 ---- .../mysql/MySqlClusterIntegrationTest.java | 44 -- .../database/mysql/MySqlClusterLiveEc2Test.java | 43 -- .../mysql/MySqlClusterLiveSoftlayerTest.java | 39 -- .../database/mysql/MySqlClusterTestHelper.java | 115 ----- .../database/mysql/MySqlIntegrationTest.java | 106 ---- .../entity/database/mysql/MySqlLiveEc2Test.java | 53 -- .../entity/database/mysql/MySqlLiveGceTest.java | 49 -- .../database/mysql/MySqlLiveRackspaceTest.java | 107 ---- .../mysql/MySqlRestartIntegrationTest.java | 42 -- .../database/mysql/MysqlDockerLiveTest.java | 48 -- .../postgresql/PostgreSqDockerLiveTest.java | 46 -- .../database/postgresql/PostgreSqlChefTest.java | 105 ---- .../postgresql/PostgreSqlEc2LiveTest.java | 54 -- .../postgresql/PostgreSqlGceLiveTest.java | 46 -- .../postgresql/PostgreSqlIntegrationTest.java | 97 ---- .../postgresql/PostgreSqlRackspaceLiveTest.java | 108 ---- .../PostgreSqlRebindIntegrationTest.java | 58 --- .../PostgreSqlRestartIntegrationTest.java | 50 -- .../database/rubyrep/RubyRepEc2LiveTest.java | 75 --- .../rubyrep/RubyRepIntegrationTest.java | 191 ------- .../rubyrep/RubyRepRackspaceLiveTest.java | 130 ----- .../entity/database/VogellaExampleAccess.java | 161 ++++++ .../crate/CrateNodeIntegrationTest.java | 64 +++ .../mariadb/MariaDbIntegrationTest.java | 125 +++++ .../database/mariadb/MariaDbLiveEc2Test.java | 57 +++ .../mariadb/MariaDbLiveRackspaceTest.java | 104 ++++ .../mysql/MySqlClusterIntegrationTest.java | 44 ++ .../database/mysql/MySqlClusterLiveEc2Test.java | 43 ++ .../mysql/MySqlClusterLiveSoftlayerTest.java | 39 ++ .../database/mysql/MySqlClusterTestHelper.java | 115 +++++ .../database/mysql/MySqlIntegrationTest.java | 106 ++++ .../entity/database/mysql/MySqlLiveEc2Test.java | 53 ++ .../entity/database/mysql/MySqlLiveGceTest.java | 49 ++ .../database/mysql/MySqlLiveRackspaceTest.java | 107 ++++ .../mysql/MySqlRestartIntegrationTest.java | 42 ++ .../database/mysql/MysqlDockerLiveTest.java | 48 ++ .../postgresql/PostgreSqDockerLiveTest.java | 46 ++ .../database/postgresql/PostgreSqlChefTest.java | 105 ++++ .../postgresql/PostgreSqlEc2LiveTest.java | 54 ++ .../postgresql/PostgreSqlGceLiveTest.java | 46 ++ .../postgresql/PostgreSqlIntegrationTest.java | 96 ++++ .../postgresql/PostgreSqlRackspaceLiveTest.java | 108 ++++ .../PostgreSqlRebindIntegrationTest.java | 58 +++ .../PostgreSqlRestartIntegrationTest.java | 50 ++ .../database/rubyrep/RubyRepEc2LiveTest.java | 75 +++ .../rubyrep/RubyRepIntegrationTest.java | 191 +++++++ .../rubyrep/RubyRepRackspaceLiveTest.java | 130 +++++ .../monitoring/monit/MonitIntegrationTest.java | 2 +- .../nosql/cassandra/CassandraDatacenter.java | 2 +- .../entity/nosql/cassandra/CassandraNode.java | 2 +- .../nosql/cassandra/CassandraNodeSshDriver.java | 2 +- .../nosql/elasticsearch/ElasticSearchNode.java | 2 +- .../app/ClusterWebServerDatabaseSample.java | 4 +- .../brooklyn/sample/app/SampleUnitTest.java | 4 +- .../java-web-app-and-db-with-function-2.yaml | 2 +- .../java-web-app-and-db-with-function.yaml | 2 +- .../java-web-app-and-db-with-policy.yaml | 2 +- ...-java-web-app-spec-and-db-with-function.yaml | 2 +- .../java-web-app-and-db-with-function.yaml | 2 +- .../launcher/src/test/resources/mssql-test.yaml | 12 +- .../test/resources/postgres-gce-blueprint.yaml | 2 +- .../qa/load/SimulatedMySqlNodeImpl.java | 6 +- .../brooklyn/qa/load/SimulatedTheeTierApp.java | 2 +- 162 files changed, 6749 insertions(+), 6752 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/docs/guide/start/_my-web-cluster.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/start/_my-web-cluster.yaml b/docs/guide/start/_my-web-cluster.yaml index ded2a69..d4c5ce6 100644 --- a/docs/guide/start/_my-web-cluster.yaml +++ b/docs/guide/start/_my-web-cluster.yaml @@ -14,7 +14,7 @@ services: component("db").attributeWhenReady("datastore.url"), "visitors", "brooklyn", "br00k11n") -- type: brooklyn.entity.database.mysql.MySqlNode +- type: org.apache.brooklyn.entity.database.mysql.MySqlNode id: db name: My DB brooklyn.config: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/docs/guide/yaml/example_yaml/appserver-clustered-w-db-concise.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/example_yaml/appserver-clustered-w-db-concise.yaml b/docs/guide/yaml/example_yaml/appserver-clustered-w-db-concise.yaml index 9e51c0a..0fd8759 100644 --- a/docs/guide/yaml/example_yaml/appserver-clustered-w-db-concise.yaml +++ b/docs/guide/yaml/example_yaml/appserver-clustered-w-db-concise.yaml @@ -8,7 +8,7 @@ services: java.sysprops: brooklyn.example.db.url: $brooklyn:formatString("jdbc:%s%s?user=%s\\&password=%s", component("db").attributeWhenReady("datastore.url"), "visitors", "brooklyn", "br00k11n") -- type: brooklyn.entity.database.mysql.MySqlNode +- type: org.apache.brooklyn.entity.database.mysql.MySqlNode id: db name: DB HelloWorld Visitors brooklyn.config: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/docs/guide/yaml/example_yaml/appserver-clustered-w-db.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/example_yaml/appserver-clustered-w-db.yaml b/docs/guide/yaml/example_yaml/appserver-clustered-w-db.yaml index 10592d8..79bc187 100644 --- a/docs/guide/yaml/example_yaml/appserver-clustered-w-db.yaml +++ b/docs/guide/yaml/example_yaml/appserver-clustered-w-db.yaml @@ -11,7 +11,7 @@ services: java.sysprops: brooklyn.example.db.url: $brooklyn:formatString("jdbc:%s%s?user=%s\\&password=%s", component("db").attributeWhenReady("datastore.url"), "visitors", "brooklyn", "br00k11n") -- type: brooklyn.entity.database.mysql.MySqlNode +- type: org.apache.brooklyn.entity.database.mysql.MySqlNode id: db name: DB HelloWorld Visitors brooklyn.config: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/docs/guide/yaml/example_yaml/appserver-w-db-other-flavor.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/example_yaml/appserver-w-db-other-flavor.yaml b/docs/guide/yaml/example_yaml/appserver-w-db-other-flavor.yaml index 6a4a81d..8c0fa2a 100644 --- a/docs/guide/yaml/example_yaml/appserver-w-db-other-flavor.yaml +++ b/docs/guide/yaml/example_yaml/appserver-w-db-other-flavor.yaml @@ -8,7 +8,7 @@ services: java.sysprops: brooklyn.example.db.url: $brooklyn:formatString("jdbc:%s%s?user=%s\\&password=%s", component("db").attributeWhenReady("datastore.url"), "visitors", "brooklyn", "br00k11n") -- type: brooklyn.entity.database.mariadb.MariaDbNode +- type: org.apache.brooklyn.entity.database.mariadb.MariaDbNode id: db name: DB HelloWorld Visitors brooklyn.config: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/docs/guide/yaml/example_yaml/appserver-w-db.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/example_yaml/appserver-w-db.yaml b/docs/guide/yaml/example_yaml/appserver-w-db.yaml index a043f1a..adc90f0 100644 --- a/docs/guide/yaml/example_yaml/appserver-w-db.yaml +++ b/docs/guide/yaml/example_yaml/appserver-w-db.yaml @@ -8,7 +8,7 @@ services: java.sysprops: brooklyn.example.db.url: $brooklyn:formatString("jdbc:%s%s?user=%s\\&password=%s", component("db").attributeWhenReady("datastore.url"), "visitors", "brooklyn", "br00k11n") -- type: brooklyn.entity.database.mysql.MySqlNode +- type: org.apache.brooklyn.entity.database.mysql.MySqlNode id: db name: DB HelloWorld Visitors brooklyn.config: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/docs/guide/yaml/example_yaml/appserver-w-policy.yaml ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/example_yaml/appserver-w-policy.yaml b/docs/guide/yaml/example_yaml/appserver-w-policy.yaml index cada61f..34480b1 100644 --- a/docs/guide/yaml/example_yaml/appserver-w-policy.yaml +++ b/docs/guide/yaml/example_yaml/appserver-w-policy.yaml @@ -19,7 +19,7 @@ services: metricUpperBound: 100 minPoolSize: 1 maxPoolSize: 5 -- type: brooklyn.entity.database.mysql.MySqlNode +- type: org.apache.brooklyn.entity.database.mysql.MySqlNode id: db name: DB HelloWorld Visitors brooklyn.config: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java ---------------------------------------------------------------------- diff --git a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java index 7084b74..4f08517 100644 --- a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java +++ b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExample.java @@ -33,7 +33,7 @@ import brooklyn.enricher.HttpLatencyDetector; import brooklyn.entity.basic.AbstractApplication; import brooklyn.entity.basic.Entities; import brooklyn.entity.basic.StartableApplication; -import brooklyn.entity.database.mysql.MySqlNode; +import org.apache.brooklyn.entity.database.mysql.MySqlNode; import brooklyn.event.basic.Sensors; import org.apache.brooklyn.api.entity.proxying.EntitySpec; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java ---------------------------------------------------------------------- diff --git a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java index 441999f..96301be 100644 --- a/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java +++ b/examples/simple-web-cluster/src/main/java/org/apache/brooklyn/demo/WebClusterDatabaseExampleApp.java @@ -45,7 +45,7 @@ import brooklyn.entity.basic.AbstractApplication; import brooklyn.entity.basic.ConfigKeys; import brooklyn.entity.basic.Entities; import brooklyn.entity.basic.StartableApplication; -import brooklyn.entity.database.mysql.MySqlNode; +import org.apache.brooklyn.entity.database.mysql.MySqlNode; import brooklyn.entity.group.DynamicCluster; import brooklyn.entity.java.JavaEntityMethods; import brooklyn.event.basic.Sensors; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java ---------------------------------------------------------------------- diff --git a/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java b/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java index 38f7059..4835af3 100644 --- a/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java +++ b/examples/simple-web-cluster/src/test/java/org/apache/brooklyn/demo/RebindWebClusterDatabaseExampleAppIntegrationTest.java @@ -51,7 +51,7 @@ import brooklyn.enricher.HttpLatencyDetector; import brooklyn.enricher.basic.Propagator; import brooklyn.entity.basic.Entities; import brooklyn.entity.basic.StartableApplication; -import brooklyn.entity.database.mysql.MySqlNode; +import org.apache.brooklyn.entity.database.mysql.MySqlNode; import brooklyn.entity.group.DynamicCluster; import brooklyn.entity.java.JavaEntityMethods; import brooklyn.entity.rebind.RebindOptions; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java ---------------------------------------------------------------------- diff --git a/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java index 2fa16fc..4cd74eb 100644 --- a/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java +++ b/sandbox/extra/src/main/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlNodeSaltImpl.java @@ -36,7 +36,7 @@ import brooklyn.entity.basic.ConfigKeys; import brooklyn.entity.basic.EffectorStartableImpl; import brooklyn.entity.basic.Entities; import brooklyn.entity.basic.SoftwareProcess; -import brooklyn.entity.database.postgresql.PostgreSqlNode; +import org.apache.brooklyn.entity.database.postgresql.PostgreSqlNode; import brooklyn.entity.effector.EffectorBody; import brooklyn.entity.effector.Effectors; import brooklyn.entity.software.SshEffectorTasks; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java ---------------------------------------------------------------------- diff --git a/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java b/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java index fde60cc..6f195bb 100644 --- a/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java +++ b/sandbox/extra/src/test/java/org/apache/brooklyn/entity/database/postgresql/PostgreSqlSaltLiveTest.java @@ -36,9 +36,9 @@ import org.testng.annotations.AfterMethod; import org.testng.annotations.Test; import brooklyn.entity.basic.Entities; -import brooklyn.entity.database.VogellaExampleAccess; -import brooklyn.entity.database.postgresql.PostgreSqlIntegrationTest; -import brooklyn.entity.database.postgresql.PostgreSqlNode; +import org.apache.brooklyn.entity.database.VogellaExampleAccess; +import org.apache.brooklyn.entity.database.postgresql.PostgreSqlIntegrationTest; +import org.apache.brooklyn.entity.database.postgresql.PostgreSqlNode; import brooklyn.entity.effector.EffectorTasks; import brooklyn.entity.software.SshEffectorTasks; import brooklyn.util.time.Duration; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/pom.xml ---------------------------------------------------------------------- diff --git a/software/database/pom.xml b/software/database/pom.xml index f98a8e3..97d571c 100644 --- a/software/database/pom.xml +++ b/software/database/pom.xml @@ -46,15 +46,15 @@ the given components. These are files "without any degree of creativity" from the perspective of the Brooklyn/Apache contribution. --> - <exclude>src/main/resources/brooklyn/entity/database/crate/crate.yaml</exclude> - <exclude>src/main/resources/brooklyn/entity/database/mariadb/my.cnf</exclude> - <exclude>src/main/resources/brooklyn/entity/database/mysql/mysql.conf</exclude> - <exclude>src/main/resources/brooklyn/entity/database/mysql/mysql_master.conf</exclude> - <exclude>src/main/resources/brooklyn/entity/database/mysql/mysql_slave.conf</exclude> - <exclude>src/main/resources/brooklyn/entity/database/postgresql/postgresql.conf</exclude> - <exclude>src/main/resources/brooklyn/entity/database/rubyrep/rubyrep.conf</exclude> - <exclude>src/main/resources/brooklyn/entity/database/mssql/ConfigurationFile.ini</exclude> - <exclude>src/main/resources/brooklyn/entity/database/mssql/mssql.yaml</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/database/crate/crate.yaml</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/database/mariadb/my.cnf</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/database/mysql/mysql.conf</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/database/mysql/mysql_master.conf</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/database/mysql/mysql_slave.conf</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/database/postgresql/postgresql.conf</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/database/rubyrep/rubyrep.conf</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/database/mssql/ConfigurationFile.ini</exclude> + <exclude>src/main/resources/org/apache/brooklyn/entity/database/mssql/mssql.yaml</exclude> </excludes> </configuration> </plugin> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/DatabaseNode.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/DatabaseNode.java b/software/database/src/main/java/brooklyn/entity/database/DatabaseNode.java deleted file mode 100644 index 33bf2e8..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/DatabaseNode.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database; - -import org.apache.brooklyn.api.event.AttributeSensor; - -/** @deprecated since 0.7.0 use DatastoreMixins.DatastoreCommon */ @Deprecated -public interface DatabaseNode extends DatastoreMixins.DatastoreCommon { - - /** @deprecated since 0.7.0 use DATASTORE_URL */ @Deprecated - public static final AttributeSensor<String> DB_URL = DATASTORE_URL; - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/DatastoreMixins.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/DatastoreMixins.java b/software/database/src/main/java/brooklyn/entity/database/DatastoreMixins.java deleted file mode 100644 index 4727473..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/DatastoreMixins.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database; - -import java.io.InputStream; - -import javax.annotation.Nullable; - -import org.apache.brooklyn.api.entity.Effector; -import org.apache.brooklyn.api.entity.Entity; -import org.apache.brooklyn.api.event.AttributeSensor; -import org.apache.brooklyn.core.util.ResourceUtils; -import org.apache.brooklyn.core.util.flags.SetFromFlag; - -import brooklyn.config.ConfigKey; -import brooklyn.entity.basic.ConfigKeys; -import brooklyn.entity.effector.Effectors; -import brooklyn.event.basic.Sensors; -import brooklyn.util.stream.KnownSizeInputStream; -import brooklyn.util.text.Strings; - -public class DatastoreMixins { - - private DatastoreMixins() {} - - - public static final AttributeSensor<String> DATASTORE_URL = HasDatastoreUrl.DATASTORE_URL; - - public static interface HasDatastoreUrl { - public static final AttributeSensor<String> DATASTORE_URL = Sensors.newStringSensor("datastore.url", - "Primary contact URL for a datastore (e.g. mysql://localhost:3306/)"); - } - - - public static final Effector<String> EXECUTE_SCRIPT = CanExecuteScript.EXECUTE_SCRIPT; - - public static interface CanExecuteScript { - public static final Effector<String> EXECUTE_SCRIPT = Effectors.effector(String.class, "executeScript") - .description("executes the given script contents") - .parameter(String.class, "commands") - .buildAbstract(); - } - - - public static final ConfigKey<String> CREATION_SCRIPT_CONTENTS = CanGiveCreationScript.CREATION_SCRIPT_CONTENTS; - public static final ConfigKey<String> CREATION_SCRIPT_URL = CanGiveCreationScript.CREATION_SCRIPT_URL; - - public static interface CanGiveCreationScript { - @SetFromFlag("creationScriptContents") - public static final ConfigKey<String> CREATION_SCRIPT_CONTENTS = ConfigKeys.newStringConfigKey( - "datastore.creation.script.contents", - "Contents of creation script to initialize the datastore", - ""); - - @SetFromFlag("creationScriptUrl") - public static final ConfigKey<String> CREATION_SCRIPT_URL = ConfigKeys.newStringConfigKey( - "datastore.creation.script.url", - "URL of creation script to use to initialize the datastore (ignored if creationScriptContents is specified)", - ""); - } - - /** returns the creation script contents, if it exists, or null if none is defined (error if it cannot be loaded) */ - @Nullable public static InputStream getDatabaseCreationScript(Entity entity) { - String url = entity.getConfig(DatastoreMixins.CREATION_SCRIPT_URL); - if (!Strings.isBlank(url)) - return new ResourceUtils(entity).getResourceFromUrl(url); - String contents = entity.getConfig(DatastoreMixins.CREATION_SCRIPT_CONTENTS); - if (!Strings.isBlank(contents)) - return KnownSizeInputStream.of(contents); - return null; - } - - /** returns the creation script contents, if it exists, or null if none is defined (error if it cannot be loaded) */ - @Nullable public static String getDatabaseCreationScriptAsString(Entity entity) { - String url = entity.getConfig(DatastoreMixins.CREATION_SCRIPT_URL); - if (!Strings.isBlank(url)) - return new ResourceUtils(entity).getResourceAsString(url); - String contents = entity.getConfig(DatastoreMixins.CREATION_SCRIPT_CONTENTS); - if (!Strings.isBlank(contents)) - return contents; - return null; - } - - /** An entity with the most common datastore config, sensors, and effectors */ - public interface DatastoreCommon extends Entity, DatastoreMixins.HasDatastoreUrl, DatastoreMixins.CanExecuteScript, DatastoreMixins.CanGiveCreationScript { - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/crate/CrateNode.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/crate/CrateNode.java b/software/database/src/main/java/brooklyn/entity/database/crate/CrateNode.java deleted file mode 100644 index 8373648..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/crate/CrateNode.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database.crate; - -import org.apache.brooklyn.api.entity.proxying.ImplementedBy; -import org.apache.brooklyn.api.event.AttributeSensor; -import org.apache.brooklyn.core.util.flags.SetFromFlag; - -import brooklyn.config.ConfigKey; -import brooklyn.entity.basic.Attributes; -import brooklyn.entity.basic.ConfigKeys; -import brooklyn.entity.basic.SoftwareProcess; -import brooklyn.entity.database.DatastoreMixins.DatastoreCommon; -import brooklyn.entity.java.UsesJava; -import brooklyn.entity.java.UsesJavaMXBeans; -import brooklyn.entity.java.UsesJmx; -import brooklyn.event.basic.AttributeSensorAndConfigKey; -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey; -import brooklyn.event.basic.PortAttributeSensorAndConfigKey; -import brooklyn.event.basic.Sensors; - -import org.apache.brooklyn.location.basic.PortRanges; - -@ImplementedBy(CrateNodeImpl.class) -public interface CrateNode extends SoftwareProcess, UsesJava,UsesJmx, UsesJavaMXBeans, DatastoreCommon { - - @SetFromFlag("version") - ConfigKey<String> SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, - "0.45.7"); - - @SetFromFlag("downloadUrl") - AttributeSensorAndConfigKey<String, String> DOWNLOAD_URL = new BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey( - Attributes.DOWNLOAD_URL, - "https://cdn.crate.io/downloads/releases/crate-${version}.tar.gz"); - - @SetFromFlag("serverConfig") - BasicAttributeSensorAndConfigKey<String> SERVER_CONFIG_URL = new BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey( - "crate.serverConfig", "A URL of a YAML file to use to configure the server", - "classpath://brooklyn/entity/database/crate/crate.yaml"); - - @SetFromFlag("port") - public static final PortAttributeSensorAndConfigKey CRATE_PORT = new PortAttributeSensorAndConfigKey( - "crate.port", "The port for node-to-node communication", PortRanges.fromString("4300+")); - - @SetFromFlag("httpPort") - public static final PortAttributeSensorAndConfigKey CRATE_HTTP_PORT = new PortAttributeSensorAndConfigKey( - "crate.httpPort", "The port for HTTP traffic", PortRanges.fromString("4200+")); - - AttributeSensor<String> MANAGEMENT_URL = Sensors.newStringSensor( - "crate.managementUri", "The address at which the Crate server listens"); - - AttributeSensor<String> SERVER_NAME = Sensors.newStringSensor( - "crate.server.name", "The name of the server"); - - AttributeSensor<Boolean> SERVER_OK = Sensors.newBooleanSensor( - "crate.server.ok", "True if the server reports thus"); - - AttributeSensor<Integer> SERVER_STATUS = Sensors.newIntegerSensor( - "crate.server.status", "The status of the server"); - - AttributeSensor<String> SERVER_BUILD_TIMESTAMP = Sensors.newStringSensor( - "crate.server.buildTimestamp", "The timestamp of the server build"); - - AttributeSensor<String> SERVER_BUILD_HASH = Sensors.newStringSensor( - "crate.server.buildHash", "The build hash of the server"); - - AttributeSensor<Boolean> SERVER_IS_BUILD_SNAPSHOT = Sensors.newBooleanSensor( - "crate.server.isBuildSnapshot", "True if the server reports it is a snapshot build"); - - AttributeSensor<String> SERVER_LUCENE_VERSION = Sensors.newStringSensor( - "crate.server.luceneVersion", "The Lucene version of the server"); - - AttributeSensor<String> SERVER_ES_VERSION = Sensors.newStringSensor( - "crate.server.esVersion", "The ES version of the server"); - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeDriver.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeDriver.java b/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeDriver.java deleted file mode 100644 index 225db07..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeDriver.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database.crate; - -import brooklyn.entity.java.JavaSoftwareProcessDriver; - -public interface CrateNodeDriver extends JavaSoftwareProcessDriver { -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeImpl.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeImpl.java b/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeImpl.java deleted file mode 100644 index 5dcfc30..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeImpl.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database.crate; - -import brooklyn.config.render.RendererHints; -import brooklyn.enricher.Enrichers; -import brooklyn.entity.basic.Attributes; -import brooklyn.entity.basic.SoftwareProcessImpl; -import brooklyn.entity.java.JavaAppUtils; -import brooklyn.event.feed.http.HttpFeed; -import brooklyn.event.feed.http.HttpPollConfig; -import brooklyn.event.feed.http.HttpValueFunctions; -import brooklyn.event.feed.jmx.JmxFeed; -import brooklyn.util.guava.Functionals; - -public class CrateNodeImpl extends SoftwareProcessImpl implements CrateNode{ - - private JmxFeed jmxFeed; - private HttpFeed httpFeed; - - static { - JavaAppUtils.init(); - RendererHints.register(MANAGEMENT_URL, RendererHints.namedActionWithUrl()); - } - - @Override - public Class getDriverInterface() { - return CrateNodeDriver.class; - } - - @Override - protected void connectSensors() { - super.connectSensors(); - connectServiceUpIsRunning(); - jmxFeed = JavaAppUtils.connectMXBeanSensors(this); - setAttribute(DATASTORE_URL, "crate://" + getAttribute(HOSTNAME) + ":" + getPort()); - String url = "http://" + getAttribute(HOSTNAME) + ":" + getHttpPort(); - setAttribute(MANAGEMENT_URL, url); - - httpFeed = HttpFeed.builder() - .entity(this) - .baseUri(url) - .poll(new HttpPollConfig<String>(SERVER_NAME) - .onSuccess(HttpValueFunctions.jsonContents("name", String.class))) - .poll(new HttpPollConfig<Integer>(SERVER_STATUS) - .onSuccess(HttpValueFunctions.jsonContents("status", Integer.class))) - .poll(new HttpPollConfig<Boolean>(SERVER_OK) - .onSuccess(HttpValueFunctions.jsonContents("ok", Boolean.class))) - .poll(new HttpPollConfig<String>(SERVER_BUILD_TIMESTAMP) - .onSuccess(HttpValueFunctions.jsonContents(new String[]{"version", "build_timestamp"}, String.class))) - .poll(new HttpPollConfig<String>(SERVER_BUILD_HASH) - .onSuccess(HttpValueFunctions.jsonContents(new String[]{"version", "build_hash"}, String.class))) - .poll(new HttpPollConfig<Boolean>(SERVER_IS_BUILD_SNAPSHOT) - .onSuccess(HttpValueFunctions.jsonContents(new String[] {"version", "build_snapshot"}, Boolean.class))) - .poll(new HttpPollConfig<String>(SERVER_LUCENE_VERSION) - .onSuccess(HttpValueFunctions.jsonContents(new String[] {"version", "lucene_version"}, String.class))) - .poll(new HttpPollConfig<String>(SERVER_ES_VERSION) - .onSuccess(HttpValueFunctions.jsonContents(new String[] {"version", "es_version"}, String.class))) - .build(); - - addEnricher(Enrichers.builder().updatingMap(Attributes.SERVICE_NOT_UP_INDICATORS) - .from(SERVER_OK) - .computing(Functionals.ifNotEquals(true).value("Crate server reports it is not ok.")) - .build()); - } - - @Override - protected void disconnectSensors() { - disconnectServiceUpIsRunning(); - if (jmxFeed != null) jmxFeed.stop(); - if (httpFeed != null) httpFeed.stop(); - super.disconnectSensors(); - } - - public Integer getPort() { - return getAttribute(CRATE_PORT); - } - - public Integer getHttpPort() { - return getAttribute(CRATE_HTTP_PORT); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeSshDriver.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeSshDriver.java b/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeSshDriver.java deleted file mode 100644 index 55610da..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/crate/CrateNodeSshDriver.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database.crate; - -import static java.lang.String.format; - -import java.util.List; - -import org.apache.brooklyn.api.entity.basic.EntityLocal; - -import com.google.common.collect.ImmutableList; - -import brooklyn.entity.basic.Entities; -import brooklyn.entity.java.JavaSoftwareProcessSshDriver; -import org.apache.brooklyn.location.basic.SshMachineLocation; -import brooklyn.util.collections.MutableMap; -import brooklyn.util.net.Urls; -import brooklyn.util.os.Os; -import brooklyn.util.ssh.BashCommands; - -public class CrateNodeSshDriver extends JavaSoftwareProcessSshDriver { - - public CrateNodeSshDriver(EntityLocal entity, SshMachineLocation machine) { - super(entity, machine); - } - - @Override - public void preInstall() { - resolver = Entities.newDownloader(this); - setExpandedInstallDir(Os.mergePaths(getInstallDir(), - resolver.getUnpackedDirectoryName(format("crate-%s", getVersion())))); - } - - @Override - public void install() { - List<String> urls = resolver.getTargets(); - String saveAs = resolver.getFilename(); - - List<String> commands = ImmutableList.<String>builder() - .addAll(BashCommands.commandsToDownloadUrlsAs(urls, saveAs)) - .add("tar xvfz "+saveAs) - .build(); - - newScript(INSTALLING) - .failOnNonZeroResultCode() - .body.append(commands).execute(); - } - - @Override - public void customize() { - newScript(CUSTOMIZING) - .body.append("mkdir -p " + getDataLocation()) - .execute(); - copyTemplate(entity.getConfig(CrateNode.SERVER_CONFIG_URL), getConfigFileLocation()); - } - - @Override - public void launch() { - StringBuilder command = new StringBuilder(getExpandedInstallDir()) - .append("/bin/crate ") - .append(" -d") - .append(" -p ").append(getPidFileLocation()) - .append(" -Des.config=").append(getConfigFileLocation()); - newScript(LAUNCHING) - .failOnNonZeroResultCode() - .body.append(command).execute(); - - } - - @Override - public boolean isRunning() { - return newScript (MutableMap.of("usePidFile", getPidFileLocation()), CHECK_RUNNING) - .execute() == 0; - } - - @Override - public void stop() { - // See https://crate.io/docs/stable/cli.html#signal-handling. - newScript(STOPPING) - .body.append("kill -USR2 `cat " + getPidFileLocation() + "`") - .execute(); - } - - protected String getConfigFileLocation() { - return Urls.mergePaths(getRunDir(), "config.yaml"); - } - - @Override - public String getLogFileLocation() { - return Urls.mergePaths(getRunDir(), "crate.log"); - } - - protected String getPidFileLocation () { - return Urls.mergePaths(getRunDir(), "pid.txt"); - } - - // public for use in template too. - public String getDataLocation() { - return Urls.mergePaths(getRunDir(), "data"); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbDriver.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbDriver.java b/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbDriver.java deleted file mode 100644 index 2db7f2ef4..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbDriver.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database.mariadb; - -import org.apache.brooklyn.core.util.task.system.ProcessTaskWrapper; - -import brooklyn.entity.basic.SoftwareProcessDriver; - -/** - * The {@link SoftwareProcessDriver} for MariaDB. - */ -public interface MariaDbDriver extends SoftwareProcessDriver { - public String getStatusCmd(); - public ProcessTaskWrapper<Integer> executeScriptAsync(String commands); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbNode.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbNode.java b/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbNode.java deleted file mode 100644 index ab77af5..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbNode.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database.mariadb; - -import org.apache.brooklyn.api.catalog.Catalog; -import org.apache.brooklyn.api.entity.proxying.ImplementedBy; -import org.apache.brooklyn.api.entity.trait.HasShortName; -import org.apache.brooklyn.api.event.AttributeSensor; -import org.apache.brooklyn.core.util.flags.SetFromFlag; - -import brooklyn.config.ConfigKey; -import brooklyn.entity.basic.Attributes; -import brooklyn.entity.basic.ConfigKeys; -import brooklyn.entity.basic.SoftwareProcess; -import brooklyn.entity.database.DatabaseNode; -import brooklyn.entity.database.DatastoreMixins.DatastoreCommon; -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey; -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey; -import brooklyn.event.basic.MapConfigKey; -import brooklyn.event.basic.PortAttributeSensorAndConfigKey; -import brooklyn.event.basic.Sensors; - -import org.apache.brooklyn.location.basic.PortRanges; - -@Catalog(name="MariaDB Node", description="MariaDB is an open source relational database management system (RDBMS)", iconUrl="classpath:///mariadb-logo-180x119.png") -@ImplementedBy(MariaDbNodeImpl.class) -public interface MariaDbNode extends SoftwareProcess, DatastoreCommon, HasShortName, DatabaseNode { - - @SetFromFlag("version") - public static final ConfigKey<String> SUGGESTED_VERSION = - ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "5.5.40"); - - // https://downloads.mariadb.org/interstitial/mariadb-5.5.33a/kvm-bintar-hardy-amd64/mariadb-5.5.33a-linux-x86_64.tar.gz/from/http://mirrors.coreix.net/mariadb - // above redirects to download the artifactd from the URLs below. - // Use `curl -sL -w "%{http_code} %{url_effective}\n" "http://..." -o target.tar.gz` to find out redirect URL. - // 64-bit: http://mirrors.coreix.net/mariadb/mariadb-5.5.40/bintar-linux-x86_64/mariadb-5.5.40-linux-x86_64.tar.gz - // 32-bit: http://mirrors.coreix.net/mariadb/mariadb-5.5.40/bintar-linux-x86/mariadb-5.5.40-linux-i686.tar.gz - - @SetFromFlag("downloadUrl") - public static final BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = new StringAttributeSensorAndConfigKey( - Attributes.DOWNLOAD_URL, "${driver.mirrorUrl}/mariadb-${version}/${driver.downloadParentDir}/mariadb-${version}-${driver.osTag}.tar.gz"); - - /** download mirror, if desired */ - @SetFromFlag("mirrorUrl") - public static final ConfigKey<String> MIRROR_URL = ConfigKeys.newStringConfigKey("mariadb.install.mirror.url", "URL of mirror", - "http://mirrors.coreix.net/mariadb/" - ); - - @SetFromFlag("port") - public static final PortAttributeSensorAndConfigKey MARIADB_PORT = - new PortAttributeSensorAndConfigKey("mariadb.port", "MariaDB port", PortRanges.fromString("3306, 13306+")); - - @SetFromFlag("dataDir") - public static final ConfigKey<String> DATA_DIR = ConfigKeys.newStringConfigKey( - "mariadb.datadir", "Directory for writing data files", null); - - @SetFromFlag("serverConf") - public static final MapConfigKey<Object> MARIADB_SERVER_CONF = new MapConfigKey<Object>( - Object.class, "mariadb.server.conf", "Configuration options for MariaDB server"); - - public static final ConfigKey<Object> MARIADB_SERVER_CONF_LOWER_CASE_TABLE_NAMES = - MARIADB_SERVER_CONF.subKey("lower_case_table_names", "See MariaDB (or MySQL!) guide. Set 1 to ignore case in table names (useful for OS portability)"); - - @SetFromFlag("password") - public static final StringAttributeSensorAndConfigKey PASSWORD = new StringAttributeSensorAndConfigKey( - "mariadb.password", "Database admin password (or randomly generated if not set)", null); - - @SetFromFlag("socketUid") - public static final StringAttributeSensorAndConfigKey SOCKET_UID = new StringAttributeSensorAndConfigKey( - "mariadb.socketUid", "Socket uid, for use in file /tmp/mysql.sock.<uid>.3306 (or randomly generated if not set)", null); - - /** @deprecated since 0.7.0 use DATASTORE_URL */ @Deprecated - public static final AttributeSensor<String> MARIADB_URL = DATASTORE_URL; - - @SetFromFlag("configurationTemplateUrl") - static final BasicAttributeSensorAndConfigKey<String> TEMPLATE_CONFIGURATION_URL = new StringAttributeSensorAndConfigKey( - "mariadb.template.configuration.url", "Template file (in freemarker format) for the my.cnf file", - "classpath://brooklyn/entity/database/mariadb/my.cnf"); - - public static final AttributeSensor<Double> QUERIES_PER_SECOND_FROM_MARIADB = - Sensors.newDoubleSensor("mariadb.queries.perSec.fromMariadb"); - - public String executeScript(String commands); -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbNodeImpl.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbNodeImpl.java b/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbNodeImpl.java deleted file mode 100644 index a22af08..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbNodeImpl.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database.mariadb; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import brooklyn.entity.basic.SoftwareProcessImpl; -import brooklyn.entity.effector.EffectorBody; -import brooklyn.event.feed.ssh.SshFeed; -import brooklyn.event.feed.ssh.SshPollConfig; -import brooklyn.event.feed.ssh.SshPollValue; - -import org.apache.brooklyn.core.util.config.ConfigBag; -import org.apache.brooklyn.location.basic.Locations; -import org.apache.brooklyn.location.basic.SshMachineLocation; - -import brooklyn.util.guava.Maybe; -import brooklyn.util.text.Identifiers; -import brooklyn.util.text.Strings; -import brooklyn.util.time.Duration; - -import com.google.common.base.Function; - -public class MariaDbNodeImpl extends SoftwareProcessImpl implements MariaDbNode { - - private static final Logger LOG = LoggerFactory.getLogger(MariaDbNodeImpl.class); - - private SshFeed feed; - - @Override - public Class<?> getDriverInterface() { - return MariaDbDriver.class; - } - - @Override - public MariaDbDriver getDriver() { - return (MariaDbDriver) super.getDriver(); - } - - @Override - public void init() { - super.init(); - getMutableEntityType().addEffector(EXECUTE_SCRIPT, new EffectorBody<String>() { - @Override - public String call(ConfigBag parameters) { - return executeScript((String)parameters.getStringKey("commands")); - } - }); - } - - @Override - protected void connectSensors() { - super.connectSensors(); - setAttribute(DATASTORE_URL, String.format("mysql://%s:%s/", getAttribute(HOSTNAME), getAttribute(MARIADB_PORT))); - - /* - * TODO status gives us things like: - * Uptime: 2427 Threads: 1 Questions: 581 Slow queries: 0 Opens: 53 Flush tables: 1 Open tables: 35 Queries per second avg: 0.239 - * So can extract lots of sensors from that. - */ - Maybe<SshMachineLocation> machine = Locations.findUniqueSshMachineLocation(getLocations()); - - if (machine.isPresent()) { - String cmd = getDriver().getStatusCmd(); - feed = SshFeed.builder() - .entity(this) - .period(Duration.FIVE_SECONDS) - .machine(machine.get()) - .poll(new SshPollConfig<Boolean>(SERVICE_UP) - .command(cmd) - .setOnSuccess(true) - .setOnFailureOrException(false)) - .poll(new SshPollConfig<Double>(QUERIES_PER_SECOND_FROM_MARIADB) - .command(cmd) - .onSuccess(new Function<SshPollValue, Double>() { - public Double apply(SshPollValue input) { - String q = Strings.getFirstWordAfter(input.getStdout(), "Queries per second avg:"); - return (q == null) ? null : Double.parseDouble(q); - }}) - .setOnFailureOrException(null) ) - .build(); - } else { - LOG.warn("Location(s) {} not an ssh-machine location, so not polling for status; setting serviceUp immediately", getLocations()); - setAttribute(SERVICE_UP, true); - } - } - - @Override - protected void disconnectSensors() { - if (feed != null) feed.stop(); - super.disconnectSensors(); - } - - public int getPort() { - return getAttribute(MARIADB_PORT); - } - - public String getSocketUid() { - String result = getAttribute(MariaDbNode.SOCKET_UID); - if (Strings.isBlank(result)) - setAttribute(MariaDbNode.SOCKET_UID, (result = Identifiers.makeRandomId(6))); - return result; - } - - public String getPassword() { - String result = getAttribute(MariaDbNode.PASSWORD); - if (Strings.isBlank(result)) - setAttribute(MariaDbNode.PASSWORD, (result = Identifiers.makeRandomId(6))); - return result; - } - - @Override - public String getShortName() { - return "MariaDB"; - } - - @Override - public String executeScript(String commands) { - return getDriver().executeScriptAsync(commands).block().getStdout(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbSshDriver.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbSshDriver.java b/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbSshDriver.java deleted file mode 100644 index 4d916b9..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/mariadb/MariaDbSshDriver.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database.mariadb; - -import static brooklyn.util.JavaGroovyEquivalents.groovyTruth; -import static brooklyn.util.ssh.BashCommands.commandsToDownloadUrlsAs; -import static brooklyn.util.ssh.BashCommands.installPackage; -import static brooklyn.util.ssh.BashCommands.ok; -import static java.lang.String.format; - -import java.io.InputStream; -import java.io.Reader; -import java.io.StringReader; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import brooklyn.entity.basic.AbstractSoftwareProcessSshDriver; -import brooklyn.entity.basic.Attributes; -import brooklyn.entity.basic.Entities; -import brooklyn.entity.database.DatastoreMixins; -import brooklyn.entity.software.SshEffectorTasks; - -import org.apache.brooklyn.api.location.OsDetails; -import org.apache.brooklyn.core.util.task.DynamicTasks; -import org.apache.brooklyn.core.util.task.system.ProcessTaskWrapper; -import org.apache.brooklyn.location.basic.SshMachineLocation; - -import brooklyn.util.collections.MutableMap; -import brooklyn.util.net.Urls; -import brooklyn.util.os.Os; -import brooklyn.util.ssh.BashCommands; -import brooklyn.util.text.Identifiers; -import brooklyn.util.text.Strings; -import brooklyn.util.time.CountdownTimer; -import brooklyn.util.time.Duration; - -import com.google.common.collect.ImmutableMap; - -/** - * The SSH implementation of the {@link MariaDbDriver}. - */ -public class MariaDbSshDriver extends AbstractSoftwareProcessSshDriver implements MariaDbDriver { - - public static final Logger log = LoggerFactory.getLogger(MariaDbSshDriver.class); - - public MariaDbSshDriver(MariaDbNodeImpl entity, SshMachineLocation machine) { - super(entity, machine); - - entity.setAttribute(Attributes.LOG_FILE_LOCATION, getLogFile()); - } - - public String getOsTag() { - OsDetails os = getLocation().getOsDetails(); - // NOTE: cannot rely on OsDetails.isLinux() to return true for all linux flavours, so - // explicitly test for unsupported OSes, otherwise assume generic linux. - if (os == null) return "linux-i686"; - if (os.isWindows() || os.isMac()) - throw new UnsupportedOperationException("only support linux versions just now; OS details: " + os); - return (os.is64bit() ? "linux-x86_64" : "linux-i686"); - } - - public String getDownloadParentDir() { - // NOTE: cannot rely on OsDetails.isLinux() to return true for all linux flavours, so - // explicitly test for unsupported OSes, otherwise assume generic linux. - OsDetails os = getLocation().getOsDetails(); - if (os == null) return "bintar-linux-x86"; - if (os.isWindows() || os.isMac()) - throw new UnsupportedOperationException("only support linux versions just now; OS details: " + os); - return (os.is64bit() ? "bintar-linux-x86_64" : "bintar-linux-x86"); - } - - public String getMirrorUrl() { - return entity.getConfig(MariaDbNode.MIRROR_URL); - } - - public String getBaseDir() { return getExpandedInstallDir(); } - - public String getDataDir() { - String result = entity.getConfig(MariaDbNode.DATA_DIR); - return (result == null) ? "." : result; - } - - public String getLogFile() { - return Urls.mergePaths(getRunDir(), "console.log"); - } - - public String getConfigFile() { - return "my.cnf"; - } - - public String getInstallFilename() { - return String.format("mariadb-%s-%s.tar.gz", getVersion(), getOsTag()); - } - - @Override - public void preInstall() { - resolver = Entities.newDownloader(this, ImmutableMap.of("filename", getInstallFilename())); - setExpandedInstallDir(Os.mergePaths(getInstallDir(), resolver.getUnpackedDirectoryName(format("mariadb-%s-%s", getVersion(), getOsTag())))); - } - - @Override - public void install() { - List<String> urls = resolver.getTargets(); - String saveAs = resolver.getFilename(); - - List<String> commands = new LinkedList<String>(); - commands.add(BashCommands.INSTALL_TAR); - commands.add(BashCommands.INSTALL_CURL); - - commands.add("echo installing extra packages"); - commands.add(installPackage(ImmutableMap.of("yum", "libgcc_s.so.1"), null)); - commands.add(installPackage(ImmutableMap.of("yum", "libaio.so.1 libncurses.so.5", "apt", "libaio1 libaio-dev"), null)); - - // these deps are needed on some OS versions but others don't need them so ignore failures (ok(...)) - commands.add(ok(installPackage(ImmutableMap.of("yum", "libaio", "apt", "ia32-libs"), null))); - commands.add("echo finished installing extra packages"); - - commands.addAll(commandsToDownloadUrlsAs(urls, saveAs)); - commands.add(format("tar xfvz %s", saveAs)); - - newScript(INSTALLING).body.append(commands).execute(); - } - - public MariaDbNodeImpl getEntity() { return (MariaDbNodeImpl) super.getEntity(); } - public int getPort() { return getEntity().getPort(); } - public String getSocketUid() { return getEntity().getSocketUid(); } - public String getPassword() { return getEntity().getPassword(); } - - @Override - public void customize() { - copyDatabaseConfigScript(); - - newScript(CUSTOMIZING) - .updateTaskAndFailOnNonZeroResultCode() - .body.append( - "chmod 600 "+getConfigFile(), - getBaseDir()+"/scripts/mysql_install_db "+ - "--basedir="+getBaseDir()+" --datadir="+getDataDir()+" "+ - "--defaults-file="+getConfigFile()) - .execute(); - - // launch, then we will configure it - launch(); - - CountdownTimer timer = Duration.seconds(20).countdownTimer(); - boolean hasCreationScript = copyDatabaseCreationScript(); - timer.waitForExpiryUnchecked(); - - DynamicTasks.queue( - SshEffectorTasks.ssh( - "cd "+getRunDir(), - getBaseDir()+"/bin/mysqladmin --defaults-file="+getConfigFile()+" --password= password "+getPassword() - ).summary("setting password")); - - if (hasCreationScript) - executeScriptFromInstalledFileAsync("creation-script.sql"); - - // not sure necessary to stop then subsequently launch, but seems safest - // (if skipping, use a flag in launch to indicate we've just launched it) - stop(); - } - - private void copyDatabaseConfigScript() { - newScript(CUSTOMIZING).execute(); //create the directory - - String configScriptContents = processTemplate(entity.getAttribute(MariaDbNode.TEMPLATE_CONFIGURATION_URL)); - Reader configContents = new StringReader(configScriptContents); - - getMachine().copyTo(configContents, Urls.mergePaths(getRunDir(), getConfigFile())); - } - - private boolean copyDatabaseCreationScript() { - InputStream creationScript = DatastoreMixins.getDatabaseCreationScript(entity); - if (creationScript==null) return false; - getMachine().copyTo(creationScript, getRunDir() + "/creation-script.sql"); - return true; - } - - public String getMariaDbServerOptionsString() { - Map<String, Object> options = entity.getConfig(MariaDbNode.MARIADB_SERVER_CONF); - StringBuilder result = new StringBuilder(); - if (groovyTruth(options)) { - for (Map.Entry<String, Object> entry : options.entrySet()) { - result.append(entry.getKey()); - String value = entry.getValue().toString(); - if (!Strings.isEmpty(value)) { - result.append(" = ").append(value); - } - result.append('\n'); - } - } - return result.toString(); - } - - @Override - public void launch() { - newScript(MutableMap.of("usePidFile", true), LAUNCHING) - .updateTaskAndFailOnNonZeroResultCode() - .body.append(format("nohup %s/bin/mysqld --defaults-file=%s --user=`whoami` > %s 2>&1 < /dev/null &", getBaseDir(), getConfigFile(), getLogFile())) - .execute(); - } - - @Override - public boolean isRunning() { - return newScript(MutableMap.of("usePidFile", false), CHECK_RUNNING) - .body.append(getStatusCmd()) - .execute() == 0; - } - - @Override - public void stop() { - newScript(MutableMap.of("usePidFile", true), STOPPING).execute(); - } - - @Override - public void kill() { - newScript(MutableMap.of("usePidFile", true), KILLING).execute(); - } - - @Override - public String getStatusCmd() { - return format("%s/bin/mysqladmin --defaults-file=%s status", getExpandedInstallDir(), Urls.mergePaths(getRunDir(), getConfigFile())); - } - - public ProcessTaskWrapper<Integer> executeScriptAsync(String commands) { - String filename = "mariadb-commands-"+Identifiers.makeRandomId(8); - DynamicTasks.queue(SshEffectorTasks.put(Urls.mergePaths(getRunDir(), filename)).contents(commands).summary("copying datastore script to execute "+filename)); - return executeScriptFromInstalledFileAsync(filename); - } - - public ProcessTaskWrapper<Integer> executeScriptFromInstalledFileAsync(String filenameAlreadyInstalledAtServer) { - return DynamicTasks.queue( - SshEffectorTasks.ssh( - "cd "+getRunDir(), - getBaseDir()+"/bin/mysql --defaults-file="+getConfigFile()+" < "+filenameAlreadyInstalledAtServer) - .summary("executing datastore script "+filenameAlreadyInstalledAtServer)); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/ac1a7c09/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlCluster.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlCluster.java b/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlCluster.java deleted file mode 100644 index 3badd77..0000000 --- a/software/database/src/main/java/brooklyn/entity/database/mysql/MySqlCluster.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package brooklyn.entity.database.mysql; - -import java.util.Collection; - -import org.apache.brooklyn.api.catalog.Catalog; -import org.apache.brooklyn.api.entity.proxying.ImplementedBy; -import org.apache.brooklyn.api.event.AttributeSensor; - -import com.google.common.reflect.TypeToken; - -import brooklyn.config.ConfigKey; -import brooklyn.entity.basic.ConfigKeys; -import brooklyn.entity.database.DatastoreMixins.HasDatastoreUrl; -import brooklyn.entity.group.DynamicCluster; -import brooklyn.event.basic.BasicAttributeSensorAndConfigKey.StringAttributeSensorAndConfigKey; -import brooklyn.event.basic.Sensors; - -@ImplementedBy(MySqlClusterImpl.class) -@Catalog(name="MySql Master-Slave cluster", description="Sets up a cluster of MySQL nodes using master-slave relation and binary logging", iconUrl="classpath:///mysql-logo-110x57.png") -public interface MySqlCluster extends DynamicCluster, HasDatastoreUrl { - interface MySqlMaster { - AttributeSensor<String> MASTER_LOG_FILE = Sensors.newStringSensor("mysql.master.log_file", "The binary log file master is writing to"); - AttributeSensor<Integer> MASTER_LOG_POSITION = Sensors.newIntegerSensor("mysql.master.log_position", "The position in the log file to start replication"); - } - interface MySqlSlave { - AttributeSensor<Boolean> SLAVE_HEALTHY = Sensors.newBooleanSensor("mysql.slave.healthy", "Indicates that the replication state of the slave is healthy"); - AttributeSensor<Integer> SLAVE_SECONDS_BEHIND_MASTER = Sensors.newIntegerSensor("mysql.slave.seconds_behind_master", "How many seconds behind master is the replication state on the slave"); - } - - ConfigKey<String> SLAVE_USERNAME = ConfigKeys.newStringConfigKey( - "mysql.slave.username", "The user name slaves will use to connect to the master", "slave"); - ConfigKey<String> SLAVE_REPLICATE_DO_DB = ConfigKeys.newStringConfigKey( - "mysql.slave.replicate_do_db", "Replicate only listed DBs"); - ConfigKey<String> SLAVE_REPLICATE_IGNORE_DB = ConfigKeys.newStringConfigKey( - "mysql.slave.replicate_ignore_db", "Don't replicate listed DBs"); - ConfigKey<String> SLAVE_REPLICATE_DO_TABLE = ConfigKeys.newStringConfigKey( - "mysql.slave.replicate_do_table", "Replicate only listed tables"); - ConfigKey<String> SLAVE_REPLICATE_IGNORE_TABLE = ConfigKeys.newStringConfigKey( - "mysql.slave.replicate_ignore_table", "Don't replicate listed tables"); - ConfigKey<String> SLAVE_REPLICATE_WILD_DO_TABLE = ConfigKeys.newStringConfigKey( - "mysql.slave.replicate_wild_do_table", "Replicate only listed tables, wildcards acepted"); - ConfigKey<String> SLAVE_REPLICATE_WILD_IGNORE_TABLE = ConfigKeys.newStringConfigKey( - "mysql.slave.replicate_wild_ignore_table", "Don't replicate listed tables, wildcards acepted"); - StringAttributeSensorAndConfigKey SLAVE_PASSWORD = new StringAttributeSensorAndConfigKey( - "mysql.slave.password", "The password slaves will use to connect to the master. Will be auto-generated by default."); - @SuppressWarnings("serial") - AttributeSensor<Collection<String>> SLAVE_DATASTORE_URL_LIST = Sensors.newSensor(new TypeToken<Collection<String>>() {}, - "mysql.slave.datastore.url", "List of all slave's DATASTORE_URL sensors"); - AttributeSensor<Double> QUERIES_PER_SECOND_FROM_MYSQL_PER_NODE = Sensors.newDoubleSensor("mysql.queries.perSec.fromMysql.perNode"); -}
