Repository: brooklyn-library Updated Branches: refs/heads/master e6eb89a1a -> b4f1eaf1f
Improve config key descriptions Also marks most important config keys as âCatalogConfigâ on some entities/policies/enrichers. Project: http://git-wip-us.apache.org/repos/asf/brooklyn-library/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-library/commit/d1cb5c62 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-library/tree/d1cb5c62 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-library/diff/d1cb5c62 Branch: refs/heads/master Commit: d1cb5c62ab6c72f2c8634c9b4023e9bd34f6d620 Parents: e6eb89a Author: Aled Sage <[email protected]> Authored: Tue Sep 12 18:35:12 2017 +0100 Committer: Aled Sage <[email protected]> Committed: Tue Sep 12 18:35:12 2017 +0100 ---------------------------------------------------------------------- .../entity/database/DatastoreMixins.java | 8 ++++- .../entity/database/mysql/MySqlNode.java | 25 ++++++++----- .../brooklyn/entity/proxy/LoadBalancer.java | 38 +++++++++++++++----- .../entity/proxy/nginx/NginxController.java | 30 +++++++++++----- .../entity/webapp/tomcat/Tomcat8Server.java | 6 ++-- .../entity/webapp/tomcat/TomcatServer.java | 20 +++++++---- 6 files changed, 93 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/d1cb5c62/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java b/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java index 5490e08..def05a3 100644 --- a/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java +++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/DatastoreMixins.java @@ -25,6 +25,8 @@ import java.io.UnsupportedEncodingException; import javax.annotation.Nullable; import com.google.common.collect.ImmutableMap; + +import org.apache.brooklyn.api.catalog.CatalogConfig; import org.apache.brooklyn.api.effector.Effector; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.sensor.AttributeSensor; @@ -69,22 +71,26 @@ public class DatastoreMixins { public static final ConfigKey<String> CREATION_SCRIPT_TEMPLATE = CanGiveCreationScript.CREATION_SCRIPT_TEMPLATE; public static interface CanGiveCreationScript { + @CatalogConfig(label = "Creation script contents") @SetFromFlag("creationScriptContents") public static final ConfigKey<String> CREATION_SCRIPT_CONTENTS = ConfigKeys.newStringConfigKey( "datastore.creation.script.contents", "Contents of creation script to initialize the datastore", ""); + @CatalogConfig(label = "Creation script URL") @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)", ""); + @CatalogConfig(label = "Creation script template URL") @SetFromFlag("creationScriptTemplateUrl") public static final ConfigKey<String> CREATION_SCRIPT_TEMPLATE = ConfigKeys.newStringConfigKey( "datastore.creation.script.template.url", - "URL of creation script Freemarker template used to initialize the datastore (ignored if datastore.creation.script.contents or datastore.creation.script.url is specified)", + "URL of creation script Freemarker template used to initialize the datastore " + + "(ignored if datastore.creation.script.contents or datastore.creation.script.url is specified)", ""); } http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/d1cb5c62/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlNode.java ---------------------------------------------------------------------- diff --git a/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlNode.java b/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlNode.java index 568aac5..2996ff4 100644 --- a/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlNode.java +++ b/software/database/src/main/java/org/apache/brooklyn/entity/database/mysql/MySqlNode.java @@ -61,7 +61,8 @@ public interface MySqlNode extends SoftwareProcess, HasShortName, DatastoreCommo @SetFromFlag("serverConf") MapConfigKey<Object> MYSQL_SERVER_CONF = new MapConfigKey<Object>( - Object.class, "mysql.server.conf", "Configuration options for mysqld"); + Object.class, "mysql.server.conf", + "Configuration options for mysqld (appended to mysql.conf in the format 'key = value')"); 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)"); @@ -69,25 +70,31 @@ public interface MySqlNode extends SoftwareProcess, HasShortName, DatastoreCommo ConfigKey<Integer> MYSQL_SERVER_ID = ConfigKeys.newIntegerConfigKey("mysql.server_id", "Corresponds to server_id option", 0); @SetFromFlag("user") - AttributeSensor USER = Sensors.newStringSensor("mysql.user", "Database admin user (default is `root`)"); + AttributeSensor<String> USER = Sensors.newStringSensor("mysql.user", + "Database admin user (default is 'root')"); @SetFromFlag("password") StringAttributeSensorAndConfigKey PASSWORD = new StringAttributeSensorAndConfigKey( - "mysql.password", "Database admin password (or randomly generated if not set)", null); + "mysql.password", + "Database admin password (or randomly generated if not set)", + null); @SetFromFlag("socketUid") StringAttributeSensorAndConfigKey SOCKET_UID = new StringAttributeSensorAndConfigKey( - "mysql.socketUid", "Socket uid, for use in file /tmp/mysql.sock.<uid>.3306 (or randomly generated if not set)", null); + "mysql.socketUid", + "Socket uid, for use in file /tmp/mysql.sock.<uid>.3306 (or randomly generated if not set)", + null); @SetFromFlag("generalLog") - ConfigKey GENERAL_LOG = ConfigKeys.newBooleanConfigKey("mysql.general_log", "Enable general log", false); - - /** @deprecated since 0.7.0 use DATASTORE_URL */ @Deprecated - AttributeSensor<String> MYSQL_URL = DATASTORE_URL; + ConfigKey<Boolean> GENERAL_LOG = ConfigKeys.newBooleanConfigKey( + "mysql.general_log", + "Enable general_log option in mysql.conf", + false); @SetFromFlag("configurationTemplateUrl") BasicAttributeSensorAndConfigKey<String> TEMPLATE_CONFIGURATION_URL = new StringAttributeSensorAndConfigKey( - "mysql.template.configuration.url", "Template file (in freemarker format) for the mysql.conf file", + "mysql.template.configuration.url", + "Template file (in freemarker format) for the mysql.conf file. The default respects other config options such as 'mysql.general_log'", "classpath://org/apache/brooklyn/entity/database/mysql/mysql.conf"); AttributeSensor<Double> QUERIES_PER_SECOND_FROM_MYSQL = Sensors.newDoubleSensor("mysql.queries.perSec.fromMysql"); http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/d1cb5c62/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/LoadBalancer.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/LoadBalancer.java b/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/LoadBalancer.java index 2a81d0d..6ff9cb4 100644 --- a/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/LoadBalancer.java +++ b/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/LoadBalancer.java @@ -21,6 +21,7 @@ package org.apache.brooklyn.entity.proxy; import java.net.URI; import java.util.Map; +import org.apache.brooklyn.api.catalog.CatalogConfig; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.Group; import org.apache.brooklyn.api.sensor.AttributeSensor; @@ -55,45 +56,66 @@ import com.google.common.reflect.TypeToken; */ public interface LoadBalancer extends Entity, Startable { + @CatalogConfig(label = "Server pool") @SetFromFlag("serverPool") ConfigKey<Group> SERVER_POOL = new BasicConfigKey<Group>( - Group.class, "loadbalancer.serverpool", "The default servers to route messages to"); + Group.class, + "loadbalancer.serverpool", + "The default servers to route messages to (points at an entity of type 'Group' or 'Cluster')"); @SetFromFlag("urlMappings") ConfigKey<Group> URL_MAPPINGS = new BasicConfigKey<Group>( - Group.class, "loadbalancer.urlmappings", "Special mapping rules (e.g. for domain/path matching, rewrite, etc); not supported by all load balancers"); + Group.class, + "loadbalancer.urlmappings", + "Special mapping rules (e.g. for domain/path matching, rewrite, etc); not supported by all load balancers"); /** sensor for port to forward to on target entities */ @SuppressWarnings("serial") @SetFromFlag("portNumberSensor") public static final BasicAttributeSensorAndConfigKey<AttributeSensor<Integer>> PORT_NUMBER_SENSOR = new BasicAttributeSensorAndConfigKey<AttributeSensor<Integer>>( - new TypeToken<AttributeSensor<Integer>>() {}, "member.sensor.portNumber", "Port number sensor on members (defaults to http.port; not supported in all implementations)", Attributes.HTTP_PORT); + new TypeToken<AttributeSensor<Integer>>() {}, + "member.sensor.portNumber", + "Port number sensor on members (defaults to http.port; not supported in all implementations)", + Attributes.HTTP_PORT); /** sensor for hostname to forward to on target entities */ @SuppressWarnings("serial") @SetFromFlag("hostnameSensor") public static final BasicAttributeSensorAndConfigKey<AttributeSensor<String>> HOSTNAME_SENSOR = new BasicAttributeSensorAndConfigKey<AttributeSensor<String>>( - new TypeToken<AttributeSensor<String>>() {}, "member.sensor.hostname", "Hostname/IP sensor on members (defaults to host.subnet.hostname; not supported in all implementations)", Attributes.SUBNET_HOSTNAME); + new TypeToken<AttributeSensor<String>>() {}, + "member.sensor.hostname", + "Hostname/IP sensor on members (defaults to host.subnet.hostname; not supported in all implementations)", + Attributes.SUBNET_HOSTNAME); /** sensor for hostname to forward to on target entities */ @SuppressWarnings("serial") @SetFromFlag("hostAndPortSensor") public static final BasicAttributeSensorAndConfigKey<AttributeSensor<String>> HOST_AND_PORT_SENSOR = new BasicAttributeSensorAndConfigKey<AttributeSensor<String>>( - new TypeToken<AttributeSensor<String>>() {}, "member.sensor.hostandport", "host:port sensor on members (invalid to configure this and the portNumber or hostname sensors)", null); + new TypeToken<AttributeSensor<String>>() {}, + "member.sensor.hostandport", + "host:port sensor on members (invalid to configure this and the portNumber or hostname sensors)", + null); @SetFromFlag("port") /** port where this controller should live */ public static final PortAttributeSensorAndConfigKey PROXY_HTTP_PORT = new PortAttributeSensorAndConfigKey( - "proxy.http.port", "Main port where this proxy listens if using HTTP", ImmutableList.of(8000, "8001+")); + "proxy.http.port", + "Main port where this proxy listens if using HTTP", + ImmutableList.of(8000, "8001+")); @SetFromFlag("httpsPort") /** port where this controller should live */ public static final PortAttributeSensorAndConfigKey PROXY_HTTPS_PORT = new PortAttributeSensorAndConfigKey( - "proxy.https.port", "Main port where this proxy listens if using HTTPS", ImmutableList.of(8443, "8443+")); + "proxy.https.port", + "Main port where this proxy listens if using HTTPS", + ImmutableList.of(8443, "8443+")); @SetFromFlag("protocol") public static final BasicAttributeSensorAndConfigKey<String> PROTOCOL = new BasicAttributeSensorAndConfigKey<String>( - String.class, "proxy.protocol", "Main URL protocol this proxy answers (typically http or https)", null); + String.class, + "proxy.protocol", + "Main URL protocol this proxy answers (typically http or https)", + null); public static final AttributeSensor<String> HOSTNAME = Attributes.HOSTNAME; http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/d1cb5c62/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/nginx/NginxController.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/nginx/NginxController.java b/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/nginx/NginxController.java index a724a98..63cd317 100644 --- a/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/nginx/NginxController.java +++ b/software/webapp/src/main/java/org/apache/brooklyn/entity/proxy/nginx/NginxController.java @@ -75,11 +75,15 @@ public interface NginxController extends AbstractController, HasShortName { @SetFromFlag("stickyVersion") ConfigKey<String> STICKY_VERSION = ConfigKeys.newStringConfigKey( - "nginx.sticky.version", "Version of ngnix-sticky-module to be installed, if required", "1.2.5"); + "nginx.sticky.version", + "Version of ngnix-sticky-module to be installed, if required", + "1.2.5"); @SetFromFlag("pcreVersion") ConfigKey<String> PCRE_VERSION = ConfigKeys.newStringConfigKey( - "pcre.version", "Version of PCRE to be installed, if required", "8.37"); + "pcre.version", + "Version of PCRE to be installed, if required", + "8.37"); @SetFromFlag("downloadUrl") AttributeSensorAndConfigKey<String, String> DOWNLOAD_URL = ConfigKeys.newSensorAndConfigKeyWithDefault(SoftwareProcess.DOWNLOAD_URL, @@ -97,19 +101,25 @@ public interface NginxController extends AbstractController, HasShortName { @SetFromFlag("httpPollPeriod") ConfigKey<Long> HTTP_POLL_PERIOD = ConfigKeys.newLongConfigKey( - "nginx.sensorpoll.http", "Poll period (in milliseconds)", 1000L); + "nginx.sensorpoll.http", "Poll period (in milliseconds) for health-check over http", 1000L); @SetFromFlag("withLdOpt") ConfigKey<String> WITH_LD_OPT = ConfigKeys.newStringConfigKey( - "nginx.install.withLdOpt", "String to pass in with --with-ld-opt=\"<val>\" (and for OS X has pcre auto-appended to this)", "-L /usr/local/lib"); + "nginx.install.withLdOpt", + "String to pass in with --with-ld-opt=\"<val>\" (and for OS X has pcre auto-appended to this)", + "-L /usr/local/lib"); @SetFromFlag("withCcOpt") ConfigKey<String> WITH_CC_OPT = ConfigKeys.newStringConfigKey( - "nginx.install.withCcOpt", "String to pass in with --with-cc-opt=\"<val>\"", "-I /usr/local/include"); + "nginx.install.withCcOpt", + "String to pass in with --with-cc-opt=\"<val>\"", + "-I /usr/local/include"); @SetFromFlag("configGenerator") ConfigKey<NginxConfigFileGenerator> SERVER_CONF_GENERATOR = ConfigKeys.newConfigKey(NginxConfigFileGenerator.class, - "nginx.config.generator", "The server.conf generator class", new NginxDefaultConfigGenerator()); + "nginx.config.generator", + "The server.conf generator class", + new NginxDefaultConfigGenerator()); @SetFromFlag("configTemplate") ConfigKey<String> SERVER_CONF_TEMPLATE_URL = NginxTemplateConfigGenerator.SERVER_CONF_TEMPLATE_URL; @@ -119,10 +129,14 @@ public interface NginxController extends AbstractController, HasShortName { "nginx.config.staticContentArchiveUrl", "The URL of an archive file of static content (To be copied to the server)"); AttributeSensorAndConfigKey<String, String> ACCESS_LOG_LOCATION = ConfigKeys.newStringSensorAndConfigKey( - "nginx.log.access", "Nginx access log file location", "logs/access.log"); + "nginx.log.access", + "Nginx access log file location", + "logs/access.log"); AttributeSensorAndConfigKey<String, String> ERROR_LOG_LOCATION = ConfigKeys.newStringSensorAndConfigKey( - "nginx.log.error", "Nginx error log file location", "logs/error.log"); + "nginx.log.error", + "Nginx error log file location", + "logs/error.log"); boolean isSticky(); http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/d1cb5c62/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/Tomcat8Server.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/Tomcat8Server.java b/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/Tomcat8Server.java index f638483..47ce648 100644 --- a/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/Tomcat8Server.java +++ b/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/Tomcat8Server.java @@ -48,11 +48,13 @@ public interface Tomcat8Server extends TomcatServer { @SetFromFlag("server.xml") ConfigKey<String> SERVER_XML_RESOURCE = ConfigKeys.newStringConfigKey( - "tomcat.serverxml", "The file to template and use as the Tomcat process' server.xml", + "tomcat.serverxml", + "The file to template and use as the Tomcat's server.xml", JavaClassNames.resolveClasspathUrl(Tomcat8Server.class, "tomcat8-server.xml")); @SetFromFlag("web.xml") ConfigKey<String> WEB_XML_RESOURCE = ConfigKeys.newStringConfigKey( - "tomcat.webxml", "The file to template and use as the Tomcat process' web.xml", + "tomcat.webxml", + "The file to template and use as the Tomcat's web.xml", JavaClassNames.resolveClasspathUrl(Tomcat8Server.class, "tomcat8-web.xml")); } http://git-wip-us.apache.org/repos/asf/brooklyn-library/blob/d1cb5c62/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServer.java ---------------------------------------------------------------------- diff --git a/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServer.java b/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServer.java index f71bd41..08849a4 100644 --- a/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServer.java +++ b/software/webapp/src/main/java/org/apache/brooklyn/entity/webapp/tomcat/TomcatServer.java @@ -19,6 +19,7 @@ package org.apache.brooklyn.entity.webapp.tomcat; import org.apache.brooklyn.api.catalog.Catalog; +import org.apache.brooklyn.api.catalog.CatalogConfig; import org.apache.brooklyn.api.entity.ImplementedBy; import org.apache.brooklyn.api.objs.HasShortName; import org.apache.brooklyn.api.sensor.AttributeSensor; @@ -30,6 +31,7 @@ import org.apache.brooklyn.core.sensor.PortAttributeSensorAndConfigKey; import org.apache.brooklyn.core.sensor.Sensors; import org.apache.brooklyn.entity.java.UsesJmx; import org.apache.brooklyn.entity.software.base.SoftwareProcess; +import org.apache.brooklyn.entity.webapp.JavaWebAppService; import org.apache.brooklyn.entity.webapp.JavaWebAppSoftwareProcess; import org.apache.brooklyn.util.core.ResourcePredicates; import org.apache.brooklyn.util.core.flags.SetFromFlag; @@ -45,6 +47,10 @@ import org.apache.brooklyn.util.time.Duration; @ImplementedBy(TomcatServerImpl.class) public interface TomcatServer extends JavaWebAppSoftwareProcess, UsesJmx, HasShortName { + @CatalogConfig(label = "Root WAR") + @SetFromFlag("war") + public static final ConfigKey<String> ROOT_WAR = JavaWebAppService.ROOT_WAR; + @SetFromFlag("version") ConfigKey<String> SUGGESTED_VERSION = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.SUGGESTED_VERSION, "7.0.65"); @@ -61,13 +67,14 @@ public interface TomcatServer extends JavaWebAppSoftwareProcess, UsesJmx, HasSho * so override default here to a high-numbered port. */ @SetFromFlag("shutdownPort") - PortAttributeSensorAndConfigKey SHUTDOWN_PORT = - ConfigKeys.newPortSensorAndConfigKey("tomcat.shutdownport", "Suggested shutdown port", PortRanges.fromString("31880+")); + PortAttributeSensorAndConfigKey SHUTDOWN_PORT = ConfigKeys.newPortSensorAndConfigKey( + "tomcat.shutdownport", + "Suggested shutdown port", PortRanges.fromString("31880+")); @SetFromFlag("server.xml") ConfigKey<String> SERVER_XML_RESOURCE = ConfigKeys.builder(String.class) .name("tomcat.serverxml") - .description("The file to template and use as the Tomcat process' server.xml") + .description("The file to template and use as the Tomcat's server.xml") .defaultValue(JavaClassNames.resolveClasspathUrl(TomcatServer.class, "server.xml")) .constraint(ResourcePredicates.urlExists()) .build(); @@ -75,15 +82,16 @@ public interface TomcatServer extends JavaWebAppSoftwareProcess, UsesJmx, HasSho @SetFromFlag("web.xml") ConfigKey<String> WEB_XML_RESOURCE = ConfigKeys.builder(String.class) .name("tomcat.webxml") - .description("The file to template and use as the Tomcat process' web.xml") + .description("The file to template and use as the Tomcat's web.xml") .defaultValue(JavaClassNames.resolveClasspathUrl(TomcatServer.class, "web.xml")) .constraint(ResourcePredicates.urlExists()) .build(); ConfigKey<Duration> START_TIMEOUT = ConfigKeys.newConfigKeyWithDefault(SoftwareProcess.START_TIMEOUT, Duration.FIVE_MINUTES); - AttributeSensor<String> CONNECTOR_STATUS = - Sensors.newStringSensor("webapp.tomcat.connectorStatus", "Catalina connector state name"); + AttributeSensor<String> CONNECTOR_STATUS = Sensors.newStringSensor( + "webapp.tomcat.connectorStatus", + "Catalina connector state name"); AttributeSensor<String> JMX_SERVICE_URL = UsesJmx.JMX_URL;
