brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [18/50] [abbrv] brooklyn-server git commit: Adding timestamp to the template options' name
Date Mon, 01 Feb 2016 17:50:34 GMT
Adding timestamp to the template options' name

- timeStamp replaces the previously used randId. 
- timeStamp uses the standard unix timestamp represented
  as a 8-char hex string.
- It represents the moment in time when the name is constructed. 
- It gives the possibility to search easily for instances, security
  groups, keypairs, etc based on timestamp without complicated
  enumeration

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

Branch: refs/heads/0.8.0-incubating
Commit: 62e859c97ae4c073cd79ee8c2cc380f9cb5e5147
Parents: 117d624
Author: Yavor Yanchev <yavor@yanchev.com>
Authored: Wed Aug 26 18:29:35 2015 +0300
Committer: Yavor Yanchev <yavor@yanchev.com>
Committed: Wed Aug 26 18:29:35 2015 +0300

----------------------------------------------------------------------
 .../location/cloud/names/BasicCloudMachineNamer.java  | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/62e859c9/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java
b/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java
index 4777ad4..d6445c9 100644
--- a/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java
+++ b/core/src/main/java/org/apache/brooklyn/core/location/cloud/names/BasicCloudMachineNamer.java
@@ -41,9 +41,15 @@ public class BasicCloudMachineNamer extends AbstractCloudMachineNamer {
         StringShortener shortener = Strings.shortener().separator("-");
         shortener.append("system", "brooklyn");
         
-        // randId often not necessary, as an 8-char hex identifier is added later (in jclouds?
can we override?)
-        // however it can be useful to have this early in the string, to prevent collisions
in places where it is abbreviated 
-        shortener.append("randId", Identifiers.makeRandomId(4));
+        /* timeStamp replaces the previously used randId. 
+         * 
+         * timeStamp uses the standard unix timestamp represented as a 8-char hex string.
+         * 
+         * It represents the moment in time when the name is constructed. 
+         * It gives the possibility to search easily for instances, security groups, keypairs,
etc
+         * based on timestamp without complicated enumeration        
+         */ 
+        shortener.append("timeStamp", Long.toString(System.currentTimeMillis() / 1000L, 16));
         
         String user = System.getProperty("user.name");
         if (!"brooklyn".equals(user))
@@ -79,7 +85,7 @@ public class BasicCloudMachineNamer extends AbstractCloudMachineNamer {
                 .canTruncate("user", 4)
                 .canRemove("entity")
                 .canTruncate("context", 4)
-                .canTruncate("randId", 2)
+                .canTruncate("timeStamp", 8)
                 .canRemove("user")
                 .canTruncate("appId", 2)
                 .canRemove("appId");


Mime
View raw message