Tidy up formatting

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

Branch: refs/heads/master
Commit: a5012ce60c4ed63280659e920be9ab6dc3ac1b2f
Parents: 5263b54
Author: Andrew Kennedy <[email protected]>
Authored: Thu Aug 28 17:12:28 2014 +0100
Committer: Andrew Kennedy <[email protected]>
Committed: Sat Aug 30 17:25:36 2014 +0100

----------------------------------------------------------------------
 .../entity/basic/BrooklynConfigKeys.java        | 92 ++++++++++----------
 .../brooklyn/entity/basic/SoftwareProcess.java  | 68 +++++++--------
 2 files changed, 78 insertions(+), 82 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5012ce6/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java 
b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
index d2f690f..0f99497 100644
--- a/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
+++ b/core/src/main/java/brooklyn/entity/basic/BrooklynConfigKeys.java
@@ -18,13 +18,10 @@
  */
 package brooklyn.entity.basic;
 
-import static brooklyn.entity.basic.ConfigKeys.newBooleanConfigKey;
-import static brooklyn.entity.basic.ConfigKeys.newConfigKey;
-import static brooklyn.entity.basic.ConfigKeys.newConfigKeyWithPrefix;
-import static brooklyn.entity.basic.ConfigKeys.newStringConfigKey;
+import static brooklyn.entity.basic.ConfigKeys.*;
 import brooklyn.config.BrooklynServerConfig;
 import brooklyn.config.ConfigKey;
-import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
+import brooklyn.event.basic.AttributeSensorAndConfigKey;
 import brooklyn.event.basic.TemplatedStringAttributeSensorAndConfigKey;
 import brooklyn.util.internal.ssh.ShellTool;
 import brooklyn.util.internal.ssh.SshTool;
@@ -42,25 +39,24 @@ public class BrooklynConfigKeys {
     @Deprecated /** @deprecated since 0.7.0 use BrooklynServerConfig routines 
*/
     public static final ConfigKey<String> BROOKLYN_DATA_DIR = 
BrooklynServerConfig.BROOKLYN_DATA_DIR;
 
-    public static final ConfigKey<String> ONBOX_BASE_DIR = newStringConfigKey(
-        "onbox.base.dir", "Default base directory on target machines where 
Brooklyn config data is stored; "
-        + "default depends on the location, either 
~/brooklyn-managed-processes or /tmp/brooklyn-${username} on localhost");
+    public static final ConfigKey<String> ONBOX_BASE_DIR = 
newStringConfigKey("onbox.base.dir",
+            "Default base directory on target machines where Brooklyn config 
data is stored; " +
+            "default depends on the location, either 
~/brooklyn-managed-processes or /tmp/brooklyn-${username} on localhost");
 
-    public static final ConfigKey<Boolean> SKIP_ON_BOX_BASE_DIR_RESOLUTION = 
ConfigKeys.newBooleanConfigKey(
-            "onbox.base.dir.skipResolution",
+    public static final ConfigKey<Boolean> SKIP_ON_BOX_BASE_DIR_RESOLUTION = 
ConfigKeys.newBooleanConfigKey("onbox.base.dir.skipResolution",
             "Whether to skip on-box directory resolution (which can require 
ssh'ing), and just assume the directory exists; can be set on machine or on 
entity", 
             false);
 
     // TODO Rename to VERSION, instead of SUGGESTED_VERSION? And declare as 
BasicAttributeSensorAndConfigKey?
     public static final ConfigKey<String> SUGGESTED_VERSION = 
newStringConfigKey("install.version", "Suggested version");
-    
+
     public static final ConfigKey<String> INSTALL_UNIQUE_LABEL = 
ConfigKeys.newStringConfigKey("install.unique_label",
-        "Provides a label which uniquely identifies an installation, used in 
the computation of the install dir; "
-        + "this should include something readable, and must include a hash of 
all data which differentiates an installation "
-        + "(e.g. version, plugins, etc), but should be the same where install 
dirs can be shared to allow for re-use");
-    
+            "Provides a label which uniquely identifies an installation, used 
in the computation of the install dir; " +
+            "this should include something readable, and must include a hash 
of all data which differentiates an installation " +
+            "(e.g. version, plugins, etc), but should be the same where 
install dirs can be shared to allow for re-use");
+
     public static final ConfigKey<Boolean> SKIP_INSTALLATION = 
newBooleanConfigKey("install.skip", "Skip the driver install commands entirely, 
for pre-installed software", Boolean.FALSE);
-    
+
     // The implementation in AbstractSoftwareSshDriver runs this command as an 
SSH command 
     public static final ConfigKey<String> PRE_INSTALL_COMMAND = 
ConfigKeys.newStringConfigKey("pre.install.command",
             "Command to be run prior to the install method being called on the 
driver");
@@ -70,37 +66,37 @@ public class BrooklynConfigKeys {
             "Command to be run prior to the launch method being called on the 
driver");
     public static final ConfigKey<String> POST_LAUNCH_COMMAND = 
ConfigKeys.newStringConfigKey("post.launch.command",
             "Command to be run after the launch method being called on the 
driver");
-    
-    public static final BasicAttributeSensorAndConfigKey<String> INSTALL_DIR = 
new TemplatedStringAttributeSensorAndConfigKey("install.dir", "Directory for 
this software to be installed in",
-            "${"
-            + "config['"+ONBOX_BASE_DIR.getName()+"']!"
-            + "config['"+BROOKLYN_DATA_DIR.getName()+"']!"
-            + "'/<ERROR>-ONBOX_BASE_DIR-not-set'"
-            + "}"
-            + "/"
-            + "installs/"
+
+    public static final AttributeSensorAndConfigKey<String, String> 
INSTALL_DIR = new TemplatedStringAttributeSensorAndConfigKey("install.dir", 
"Directory for this software to be installed in",
+            "${" +
+            "config['"+ONBOX_BASE_DIR.getName()+"']!" +
+            "config['"+BROOKLYN_DATA_DIR.getName()+"']!" +
+            "'/<ERROR>-ONBOX_BASE_DIR-not-set'" +
+            "}" +
+            "/" +
+            "installs/" +
             // the  var??  tests if it exists, passing value to 
?string(if_present,if_absent)
             // the ! provides a default value afterwards, which is never used, 
but is required for parsing
             // when the config key is not available;
             // thus the below prefers the install.unique_label, but falls back 
to simple name
             // plus a version identifier *if* the version is explicitly set
-            + 
"${(config['install.unique_label']??)?string(config['install.unique_label']!'X',"
-            + "(entity.entityType.simpleName)+"
-            + 
"((config['install.version']??)?string('_'+(config['install.version']!'X'),''))"
-            + ")}");
-    
-    public static final BasicAttributeSensorAndConfigKey<String> RUN_DIR = new 
TemplatedStringAttributeSensorAndConfigKey("run.dir", "Directory for this 
software to be run from",
-        "${"
-        + "config['"+ONBOX_BASE_DIR.getName()+"']!"
-        + "config['"+BROOKLYN_DATA_DIR.getName()+"']!"
-        + "'/<ERROR>-ONBOX_BASE_DIR-not-set'"
-        + "}"
-            + "/"
-            + "apps/${entity.applicationId}/"
-            + "entities/${entity.entityType.simpleName}_"
-            + "${entity.id}");
-
-    public static final BasicAttributeSensorAndConfigKey<String> 
EXPANDED_INSTALL_DIR = new TemplatedStringAttributeSensorAndConfigKey(
+            
"${(config['install.unique_label']??)?string(config['install.unique_label']!'X',"
 +
+            "(entity.entityType.simpleName)+" +
+            
"((config['install.version']??)?string('_'+(config['install.version']!'X'),''))"
 +
+            ")}");
+
+    public static final AttributeSensorAndConfigKey<String, String> RUN_DIR = 
new TemplatedStringAttributeSensorAndConfigKey("run.dir", "Directory for this 
software to be run from",
+            "${" +
+            "config['"+ONBOX_BASE_DIR.getName()+"']!" +
+            "config['"+BROOKLYN_DATA_DIR.getName()+"']!" +
+            "'/<ERROR>-ONBOX_BASE_DIR-not-set'" +
+            "}" +
+            "/" +
+            "apps/${entity.applicationId}/" +
+            "entities/${entity.entityType.simpleName}_" +
+            "${entity.id}");
+
+    public static final AttributeSensorAndConfigKey<String, String> 
EXPANDED_INSTALL_DIR = new TemplatedStringAttributeSensorAndConfigKey(
             "expandedinstall.dir", 
             "Directory for installed artifacts (e.g. expanded dir after 
unpacking .tgz)", 
             null);
@@ -124,25 +120,25 @@ public class BrooklynConfigKeys {
 
     public static final ConfigKey<Duration> START_TIMEOUT = newConfigKey(
             "start.timeout", "Time to wait for process and for SERVICE_UP 
before failing (in seconds, default 2m)", Duration.seconds(120));
-        
+
     /* selected properties from SshTool for external public access (e.g. 
putting on entities) */
-    
+
     /** Public-facing global config keys for Brooklyn are defined in 
ConfigKeys, 
      * and have this prefix pre-prended to the config keys in this class. */
     public static final String BROOKLYN_SSH_CONFIG_KEY_PREFIX = 
"brooklyn.ssh.config.";
-    
+
     // some checks (this line, and a few Preconditions below) that the remote 
values aren't null, 
     // because they have some funny circular references
     static { assert 
BROOKLYN_SSH_CONFIG_KEY_PREFIX.equals(SshTool.BROOKLYN_CONFIG_KEY_PREFIX) : 
"static final initializer classload ordering problem"; }
-    
+
     public static final ConfigKey<String> SSH_TOOL_CLASS = 
newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, 
             Preconditions.checkNotNull(SshTool.PROP_TOOL_CLASS, "static final 
initializer classload ordering problem"));
-    
+
     public static final ConfigKey<String> SSH_CONFIG_HOST = 
newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, SshTool.PROP_HOST);
     public static final ConfigKey<Integer> SSH_CONFIG_PORT = 
newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, SshTool.PROP_PORT);
     public static final ConfigKey<String> SSH_CONFIG_USER = 
newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, SshTool.PROP_USER);
     public static final ConfigKey<String> SSH_CONFIG_PASSWORD = 
newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, SshTool.PROP_PASSWORD);
-    
+
     public static final ConfigKey<String> SSH_CONFIG_SCRIPT_DIR = 
newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, 
             Preconditions.checkNotNull(ShellTool.PROP_SCRIPT_DIR, "static 
final initializer classload ordering problem"));
     public static final ConfigKey<String> SSH_CONFIG_SCRIPT_HEADER = 
newConfigKeyWithPrefix(BROOKLYN_SSH_CONFIG_KEY_PREFIX, 
ShellTool.PROP_SCRIPT_HEADER);

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a5012ce6/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
----------------------------------------------------------------------
diff --git 
a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java 
b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
index d71375f..765a819 100644
--- a/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
+++ b/software/base/src/main/java/brooklyn/entity/basic/SoftwareProcess.java
@@ -24,7 +24,7 @@ import brooklyn.config.ConfigKey;
 import brooklyn.entity.Entity;
 import brooklyn.entity.trait.Startable;
 import brooklyn.event.AttributeSensor;
-import brooklyn.event.basic.BasicAttributeSensor;
+import brooklyn.event.basic.AttributeSensorAndConfigKey;
 import brooklyn.event.basic.BasicAttributeSensorAndConfigKey;
 import brooklyn.event.basic.MapConfigKey;
 import brooklyn.event.basic.Sensors;
@@ -37,71 +37,71 @@ import com.google.common.reflect.TypeToken;
 
 public interface SoftwareProcess extends Entity, Startable {
 
-    public static final AttributeSensor<String> HOSTNAME = Attributes.HOSTNAME;
-    public static final AttributeSensor<String> ADDRESS = Attributes.ADDRESS;
-    public static final AttributeSensor<String> SUBNET_HOSTNAME = 
Attributes.SUBNET_HOSTNAME;
-    public static final AttributeSensor<String> SUBNET_ADDRESS = 
Attributes.SUBNET_ADDRESS;
+    AttributeSensor<String> HOSTNAME = Attributes.HOSTNAME;
+    AttributeSensor<String> ADDRESS = Attributes.ADDRESS;
+    AttributeSensor<String> SUBNET_HOSTNAME = Attributes.SUBNET_HOSTNAME;
+    AttributeSensor<String> SUBNET_ADDRESS = Attributes.SUBNET_ADDRESS;
 
     @SetFromFlag("startTimeout")
-    public static final ConfigKey<Duration> START_TIMEOUT = 
BrooklynConfigKeys.START_TIMEOUT;
+    ConfigKey<Duration> START_TIMEOUT = BrooklynConfigKeys.START_TIMEOUT;
 
     @SetFromFlag("startLatch")
-    public static final ConfigKey<Boolean> START_LATCH = 
BrooklynConfigKeys.START_LATCH;
+    ConfigKey<Boolean> START_LATCH = BrooklynConfigKeys.START_LATCH;
 
     @SetFromFlag("setupLatch")
-    public static final ConfigKey<Boolean> SETUP_LATCH = 
BrooklynConfigKeys.SETUP_LATCH;
+    ConfigKey<Boolean> SETUP_LATCH = BrooklynConfigKeys.SETUP_LATCH;
 
     @SetFromFlag("installLatch")
-    public static final ConfigKey<Boolean> INSTALL_LATCH = 
BrooklynConfigKeys.INSTALL_LATCH;
+    ConfigKey<Boolean> INSTALL_LATCH = BrooklynConfigKeys.INSTALL_LATCH;
 
     @SetFromFlag("customizeLatch")
-    public static final ConfigKey<Boolean> CUSTOMIZE_LATCH = 
BrooklynConfigKeys.CUSTOMIZE_LATCH;
+    ConfigKey<Boolean> CUSTOMIZE_LATCH = BrooklynConfigKeys.CUSTOMIZE_LATCH;
 
     @SetFromFlag("resourcesLatch")
-    public static final ConfigKey<Boolean> RESOURCES_LATCH = 
BrooklynConfigKeys.RESOURCES_LATCH;
+    ConfigKey<Boolean> RESOURCES_LATCH = BrooklynConfigKeys.RESOURCES_LATCH;
 
     @SetFromFlag("launchLatch")
-    public static final ConfigKey<Boolean> LAUNCH_LATCH = 
BrooklynConfigKeys.LAUNCH_LATCH;
+    ConfigKey<Boolean> LAUNCH_LATCH = BrooklynConfigKeys.LAUNCH_LATCH;
 
     @SetFromFlag("skipInstall")
-    public static final ConfigKey<Boolean> SKIP_INSTALLATION = 
BrooklynConfigKeys.SKIP_INSTALLATION;
+    ConfigKey<Boolean> SKIP_INSTALLATION = 
BrooklynConfigKeys.SKIP_INSTALLATION;
 
     @SetFromFlag("preInstallCommand")
-    public static final ConfigKey<String> PRE_INSTALL_COMMAND = 
BrooklynConfigKeys.PRE_INSTALL_COMMAND;
+    ConfigKey<String> PRE_INSTALL_COMMAND = 
BrooklynConfigKeys.PRE_INSTALL_COMMAND;
 
     @SetFromFlag("postInstallCommand")
-    public static final ConfigKey<String> POST_INSTALL_COMMAND = 
BrooklynConfigKeys.POST_INSTALL_COMMAND;
+    ConfigKey<String> POST_INSTALL_COMMAND = 
BrooklynConfigKeys.POST_INSTALL_COMMAND;
 
     @SetFromFlag("preLaunchCommand")
-    public static final ConfigKey<String> PRE_LAUNCH_COMMAND = 
BrooklynConfigKeys.PRE_LAUNCH_COMMAND;
+    ConfigKey<String> PRE_LAUNCH_COMMAND = 
BrooklynConfigKeys.PRE_LAUNCH_COMMAND;
 
     @SetFromFlag("postLaunchCommand")
-    public static final ConfigKey<String> POST_LAUNCH_COMMAND = 
BrooklynConfigKeys.POST_LAUNCH_COMMAND;
+    ConfigKey<String> POST_LAUNCH_COMMAND = 
BrooklynConfigKeys.POST_LAUNCH_COMMAND;
 
     @SetFromFlag("version")
-    public static final ConfigKey<String> SUGGESTED_VERSION = 
BrooklynConfigKeys.SUGGESTED_VERSION;
+    ConfigKey<String> SUGGESTED_VERSION = BrooklynConfigKeys.SUGGESTED_VERSION;
 
     @SetFromFlag("downloadUrl")
-    public static final BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL 
= Attributes.DOWNLOAD_URL;
+    BasicAttributeSensorAndConfigKey<String> DOWNLOAD_URL = 
Attributes.DOWNLOAD_URL;
 
     @SetFromFlag("downloadAddonUrls")
     BasicAttributeSensorAndConfigKey<Map<String,String>> DOWNLOAD_ADDON_URLS = 
Attributes.DOWNLOAD_ADDON_URLS;
 
     @SetFromFlag("installLabel")
-    public static final ConfigKey<String> INSTALL_UNIQUE_LABEL = 
BrooklynConfigKeys.INSTALL_UNIQUE_LABEL;
+    ConfigKey<String> INSTALL_UNIQUE_LABEL = 
BrooklynConfigKeys.INSTALL_UNIQUE_LABEL;
 
     @SetFromFlag("expandedInstallDir")
-    BasicAttributeSensorAndConfigKey<String> EXPANDED_INSTALL_DIR = 
BrooklynConfigKeys.EXPANDED_INSTALL_DIR;
+    AttributeSensorAndConfigKey<String,String> EXPANDED_INSTALL_DIR = 
BrooklynConfigKeys.EXPANDED_INSTALL_DIR;
 
     @SetFromFlag("installDir")
-    BasicAttributeSensorAndConfigKey<String> INSTALL_DIR = 
BrooklynConfigKeys.INSTALL_DIR;
+    AttributeSensorAndConfigKey<String,String> INSTALL_DIR = 
BrooklynConfigKeys.INSTALL_DIR;
     @Deprecated
-    public static final ConfigKey<String> SUGGESTED_INSTALL_DIR = 
BrooklynConfigKeys.SUGGESTED_INSTALL_DIR;
+    ConfigKey<String> SUGGESTED_INSTALL_DIR = 
BrooklynConfigKeys.SUGGESTED_INSTALL_DIR;
 
     @SetFromFlag("runDir")
-    BasicAttributeSensorAndConfigKey<String> RUN_DIR = 
BrooklynConfigKeys.RUN_DIR;
+    AttributeSensorAndConfigKey<String,String> RUN_DIR = 
BrooklynConfigKeys.RUN_DIR;
     @Deprecated
-    public static final ConfigKey<String> SUGGESTED_RUN_DIR = 
BrooklynConfigKeys.SUGGESTED_RUN_DIR;
+    ConfigKey<String> SUGGESTED_RUN_DIR = BrooklynConfigKeys.SUGGESTED_RUN_DIR;
 
     /** Files to be copied to the server, map of "subpath/file.name": 
"classpath://foo/file.txt" (or other url) */
     @SetFromFlag("runtimeFiles")
@@ -114,11 +114,11 @@ public interface SoftwareProcess extends Entity, 
Startable {
             "templates.runtime", "Map of templates to be filled in and copied, 
keyed by destination name relative to runDir");
 
     @SetFromFlag("env")
-    public static final MapConfigKey<Object> SHELL_ENVIRONMENT = new 
MapConfigKey<Object>(Object.class,
+    MapConfigKey<Object> SHELL_ENVIRONMENT = new 
MapConfigKey<Object>(Object.class,
             "shell.env", "Map of environment variables to pass to the runtime 
shell", MutableMap.<String,Object>of());
 
     @SetFromFlag("provisioningProperties")
-    public static final MapConfigKey<Object> PROVISIONING_PROPERTIES = new 
MapConfigKey<Object>(Object.class,
+    MapConfigKey<Object> PROVISIONING_PROPERTIES = new 
MapConfigKey<Object>(Object.class,
             "provisioning.properties", "Custom properties to be passed in when 
provisioning a new machine", MutableMap.<String,Object>of());
 
     @SetFromFlag("maxRebindSensorsDelay")
@@ -135,7 +135,7 @@ public interface SoftwareProcess extends Entity, Startable {
      * (NB: restarts are currently not propagated to children in the default 
{@link SoftwareProcess}
      * due to the various semantics which may be desired; this may change, but 
if entities have specific requirements for restart,
      * developers should either subclass the {@link 
SoftwareProcessDriverLifecycleEffectorTasks} and/or lean on sensors from the 
parent */
-    public enum ChildStartableMode {
+    enum ChildStartableMode {
         /** do nothing with {@link Startable} children */
         NONE(true, false, false),
         /** start (stop) {@link Startable} children concurrent with *driver* 
start (stop),
@@ -174,17 +174,17 @@ public interface SoftwareProcess extends Entity, 
Startable {
     }
 
     @SetFromFlag("childStartMode")
-    public static final ConfigKey<ChildStartableMode> CHILDREN_STARTABLE_MODE 
= ConfigKeys.newConfigKey(ChildStartableMode.class, "children.startable.mode");
+    ConfigKey<ChildStartableMode> CHILDREN_STARTABLE_MODE = 
ConfigKeys.newConfigKey(ChildStartableMode.class, "children.startable.mode");
 
     @SuppressWarnings("rawtypes")
-    public static final AttributeSensor<MachineProvisioningLocation> 
PROVISIONING_LOCATION = new BasicAttributeSensor<MachineProvisioningLocation>(
+    AttributeSensor<MachineProvisioningLocation> PROVISIONING_LOCATION = 
Sensors.newSensor(
             MachineProvisioningLocation.class, 
"softwareservice.provisioningLocation", "Location used to provision a machine 
where this is running");
 
-    public static final AttributeSensor<Boolean> SERVICE_PROCESS_IS_RUNNING = 
Sensors.newBooleanSensor("service.process.isRunning", 
-        "Whether the process for the service is confirmed as running");
+    AttributeSensor<Boolean> SERVICE_PROCESS_IS_RUNNING = 
Sensors.newBooleanSensor("service.process.isRunning", 
+            "Whether the process for the service is confirmed as running");
     
-    public static final AttributeSensor<Lifecycle> SERVICE_STATE_ACTUAL = 
Attributes.SERVICE_STATE_ACTUAL;
+    AttributeSensor<Lifecycle> SERVICE_STATE_ACTUAL = 
Attributes.SERVICE_STATE_ACTUAL;
  
-    public static final AttributeSensor<String> PID_FILE = 
Sensors.newStringSensor("softwareprocess.pid.file", "PID file");
+    AttributeSensor<String> PID_FILE = 
Sensors.newStringSensor("softwareprocess.pid.file", "PID file");
 
 }

Reply via email to