vas 0.4.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/README.md +1 -1
  2. data/lib/vas.rb +44 -1
  3. data/lib/vas/gemfire/agent_instances.rb +4 -3
  4. data/lib/vas/gemfire/agent_live_configurations.rb +3 -3
  5. data/lib/vas/gemfire/agent_node_instances.rb +2 -2
  6. data/lib/vas/gemfire/agent_node_live_configurations.rb +39 -0
  7. data/lib/vas/gemfire/application_code.rb +13 -12
  8. data/lib/vas/gemfire/application_code_images.rb +13 -11
  9. data/lib/vas/gemfire/cache_server_instances.rb +20 -12
  10. data/lib/vas/gemfire/cache_server_live_configurations.rb +3 -3
  11. data/lib/vas/gemfire/cache_server_node_instances.rb +16 -9
  12. data/lib/vas/gemfire/cache_server_node_live_configurations.rb +39 -0
  13. data/lib/vas/gemfire/disk_stores.rb +19 -11
  14. data/lib/vas/gemfire/gemfire.rb +4 -4
  15. data/lib/vas/gemfire/groups.rb +17 -10
  16. data/lib/vas/gemfire/installations.rb +12 -3
  17. data/lib/vas/gemfire/live_application_codes.rb +2 -2
  18. data/lib/vas/gemfire/locator_instances.rb +23 -13
  19. data/lib/vas/gemfire/locator_live_configurations.rb +3 -3
  20. data/lib/vas/gemfire/locator_node_instances.rb +22 -14
  21. data/lib/vas/gemfire/locator_node_live_configurations.rb +39 -0
  22. data/lib/vas/gemfire/nodes.rb +27 -6
  23. data/lib/vas/gemfire/pending_application_codes.rb +7 -2
  24. data/lib/vas/gemfire/statistics.rb +18 -11
  25. data/lib/vas/rabbitmq/groups.rb +6 -4
  26. data/lib/vas/rabbitmq/installations.rb +14 -6
  27. data/lib/vas/rabbitmq/instances.rb +9 -6
  28. data/lib/vas/rabbitmq/live_configurations.rb +3 -3
  29. data/lib/vas/rabbitmq/node_instances.rb +2 -2
  30. data/lib/vas/rabbitmq/node_live_configurations.rb +39 -0
  31. data/lib/vas/rabbitmq/nodes.rb +11 -8
  32. data/lib/vas/rabbitmq/plugin_images.rb +14 -7
  33. data/lib/vas/rabbitmq/plugins.rb +29 -20
  34. data/lib/vas/rabbitmq/rabbitmq.rb +4 -4
  35. data/lib/vas/shared/collection.rb +34 -11
  36. data/lib/vas/shared/configuration.rb +16 -9
  37. data/lib/vas/shared/deletable.rb +34 -0
  38. data/lib/vas/shared/groups.rb +26 -15
  39. data/lib/vas/shared/installation_images.rb +18 -10
  40. data/lib/vas/shared/installations.rb +22 -22
  41. data/lib/vas/shared/instance.rb +40 -19
  42. data/lib/vas/shared/live_configuration.rb +42 -0
  43. data/lib/vas/shared/logs.rb +27 -14
  44. data/lib/vas/shared/mutable_collection.rb +13 -5
  45. data/lib/vas/shared/node_configuration.rb +74 -0
  46. data/lib/vas/shared/node_instances.rb +32 -14
  47. data/lib/vas/shared/nodes.rb +37 -14
  48. data/lib/vas/shared/{pending_configuration.rb → pending_configurations.rb} +4 -2
  49. data/lib/vas/shared/resource.rb +12 -2
  50. data/lib/vas/shared/security.rb +11 -4
  51. data/lib/vas/shared/state_resource.rb +1 -1
  52. data/lib/vas/sqlfire/agent_instances.rb +98 -0
  53. data/lib/vas/sqlfire/agent_live_configurations.rb +39 -0
  54. data/lib/vas/sqlfire/agent_logs.rb +39 -0
  55. data/lib/vas/sqlfire/agent_node_instances.rb +54 -0
  56. data/lib/vas/sqlfire/agent_node_live_configurations.rb +39 -0
  57. data/lib/vas/sqlfire/agent_pending_configurations.rb +39 -0
  58. data/lib/vas/sqlfire/groups.rb +58 -0
  59. data/lib/vas/sqlfire/installation_images.rb +39 -0
  60. data/lib/vas/sqlfire/installations.rb +61 -0
  61. data/lib/vas/sqlfire/locator_instances.rb +210 -0
  62. data/lib/vas/sqlfire/locator_live_configurations.rb +39 -0
  63. data/lib/vas/sqlfire/locator_logs.rb +39 -0
  64. data/lib/vas/sqlfire/locator_node_instances.rb +91 -0
  65. data/lib/vas/sqlfire/locator_node_live_configurations.rb +39 -0
  66. data/lib/vas/sqlfire/locator_pending_configurations.rb +39 -0
  67. data/lib/vas/sqlfire/nodes.rb +73 -0
  68. data/lib/vas/sqlfire/server_instances.rb +192 -0
  69. data/lib/vas/sqlfire/server_live_configurations.rb +39 -0
  70. data/lib/vas/sqlfire/server_logs.rb +39 -0
  71. data/lib/vas/sqlfire/server_node_instances.rb +86 -0
  72. data/lib/vas/sqlfire/server_node_live_configurations.rb +39 -0
  73. data/lib/vas/sqlfire/server_pending_configurations.rb +39 -0
  74. data/lib/vas/sqlfire/sqlfire.rb +44 -0
  75. data/lib/vas/tc_server/applications.rb +32 -21
  76. data/lib/vas/tc_server/configuration.rb +1 -1
  77. data/lib/vas/tc_server/groups.rb +7 -4
  78. data/lib/vas/tc_server/installations.rb +16 -6
  79. data/lib/vas/tc_server/instances.rb +25 -13
  80. data/lib/vas/tc_server/live_configurations.rb +11 -1
  81. data/lib/vas/tc_server/logs.rb +4 -2
  82. data/lib/vas/tc_server/node_applications.rb +21 -17
  83. data/lib/vas/tc_server/node_instances.rb +23 -9
  84. data/lib/vas/tc_server/node_live_configurations.rb +39 -0
  85. data/lib/vas/tc_server/node_revisions.rb +15 -10
  86. data/lib/vas/tc_server/nodes.rb +15 -8
  87. data/lib/vas/tc_server/revision_images.rb +16 -10
  88. data/lib/vas/tc_server/revisions.rb +20 -16
  89. data/lib/vas/tc_server/tc_server.rb +5 -5
  90. data/lib/vas/tc_server/template_images.rb +13 -7
  91. data/lib/vas/tc_server/templates.rb +21 -13
  92. data/lib/vas/util/client.rb +15 -6
  93. data/lib/vas/vfabric/agent_image.rb +1 -1
  94. data/lib/vas/vfabric/nodes.rb +4 -11
  95. data/lib/vas/vfabric/v_fabric.rb +2 -2
  96. data/lib/vas/vfabric_administration_server.rb +37 -6
  97. data/lib/vas/web_server/configuration.rb +29 -0
  98. data/lib/vas/web_server/groups.rb +44 -0
  99. data/lib/vas/web_server/installation_images.rb +54 -0
  100. data/lib/vas/web_server/installations.rb +52 -0
  101. data/lib/vas/web_server/instances.rb +65 -0
  102. data/lib/vas/web_server/live_configurations.rb +39 -0
  103. data/lib/vas/web_server/logs.rb +37 -0
  104. data/lib/vas/web_server/node_instances.rb +39 -0
  105. data/lib/vas/web_server/node_live_configurations.rb +39 -0
  106. data/lib/vas/web_server/nodes.rb +53 -0
  107. data/lib/vas/web_server/pending_configurations.rb +39 -0
  108. data/lib/vas/web_server/web_server.rb +43 -0
  109. metadata +137 -76
@@ -28,19 +28,25 @@ module Gemfire
28
28
 
29
29
  # A disk store in a cache server node instance
30
30
  class DiskStore < Shared::Resource
31
+
32
+ include Shared::Deletable
31
33
 
32
34
  # @return [String] the name of the disk store
33
35
  attr_reader :name
34
36
 
35
- # @return [CacheServerNodeInstance] the disk store's cache server node instance
36
- attr_reader :instance
37
+ # @return [Integer] the size of the disk store
38
+ attr_reader :size
39
+
40
+ # @return [Integer] the last modified stamp of the disk store
41
+ attr_reader :last_modified
37
42
 
38
43
  # @private
39
44
  def initialize(location, client)
40
45
  super(location, client)
41
46
 
42
47
  @name = details['name']
43
- @instance = CacheServerNodeInstance.new(Util::LinkUtils.get_link_href(details, 'cache-server-node-instance'), client)
48
+
49
+ @instance_location = Util::LinkUtils.get_link_href(details, 'cache-server-node-instance')
44
50
  @content_location = Util::LinkUtils.get_link_href(details, 'content')
45
51
  end
46
52
 
@@ -52,20 +58,22 @@ module Gemfire
52
58
  def content(&block)
53
59
  client.get_stream(@content_location, &block)
54
60
  end
55
-
56
- # @return [Integer] the size of the disk store
57
- def size
58
- client.get(location)['size']
61
+
62
+ # @return [CacheServerNodeInstance] the disk store's cache server node instance
63
+ def instance
64
+ @instance ||= CacheServerNodeInstance.new(@instance_location, client)
59
65
  end
60
66
 
61
- # @return [Integer] the last modified stamp of the disk store
62
- def last_modified
63
- client.get(location)['last-modified']
67
+ # Reloads the disk store's details from the server
68
+ def reload
69
+ super
70
+ @size = details['size']
71
+ @last_modified = details['last-modified']
64
72
  end
65
73
 
66
74
  # @return [String] a string representation of the disk store
67
75
  def to_s
68
- "#<#{self.class} name='#@name'>"
76
+ "#<#{self.class} name='#@name' size='#@size' last_modified='#@last_modified'>"
69
77
  end
70
78
 
71
79
  end
@@ -37,10 +37,10 @@ module Gemfire
37
37
 
38
38
  json = client.get(location)
39
39
 
40
- @groups = Groups.new(Util::LinkUtils.get_link_href(json, "groups"), client)
41
- @installation_images = InstallationImages.new(Util::LinkUtils.get_link_href(json, "installation-images"), client)
42
- @nodes = Nodes.new(Util::LinkUtils.get_link_href(json, "nodes"), client)
43
- @application_code_images = ApplicationCodeImages.new(Util::LinkUtils.get_link_href(json, "application-code-images"), client)
40
+ @groups = Groups.new(Util::LinkUtils.get_link_href(json, 'groups'), client)
41
+ @installation_images = InstallationImages.new(Util::LinkUtils.get_link_href(json, 'installation-images'), client)
42
+ @nodes = Nodes.new(Util::LinkUtils.get_link_href(json, 'nodes'), client)
43
+ @application_code_images = ApplicationCodeImages.new(Util::LinkUtils.get_link_href(json, 'application-code-images'), client)
44
44
 
45
45
  end
46
46
 
@@ -29,21 +29,28 @@ module Gemfire
29
29
  # A GemFire group
30
30
  class Group < Shared::MutableGroup
31
31
 
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, Node, Installations)
35
+
36
+ @agent_instances_location = Util::LinkUtils.get_link_href(details, 'agent-group-instances')
37
+ @cache_server_instances_location = Util::LinkUtils.get_link_href(details, 'cache-server-group-instances')
38
+ @locator_instances_location = Util::LinkUtils.get_link_href(details, 'locator-group-instances')
39
+ end
40
+
32
41
  # @return [AgentInstances] the group's agent instances
33
- attr_reader :agent_instances
42
+ def agent_instances
43
+ @agent_instances ||= AgentInstances.new(@agent_instances_location, client)
44
+ end
34
45
 
35
46
  # @return [CacheServerInstances] the group's cache server instances
36
- attr_reader :cache_server_instances
47
+ def cache_server_instances
48
+ @cache_server_instances ||= CacheServerInstances.new(@cache_server_instances_location, client)
49
+ end
37
50
 
38
51
  # @return [LocatorInstances] the group's locator instances
39
- attr_reader :locator_instances
40
-
41
- # @private
42
- def initialize(location, client)
43
- super(location, client, Node, Installations)
44
- @agent_instances = AgentInstances.new(Util::LinkUtils.get_link_href(details, "agent-group-instances"), client)
45
- @cache_server_instances = CacheServerInstances.new(Util::LinkUtils.get_link_href(details, "cache-server-group-instances"), client)
46
- @locator_instances = LocatorInstances.new(Util::LinkUtils.get_link_href(details, "locator-group-instances"), client)
52
+ def locator_instances
53
+ @locator_instances ||= LocatorInstances.new(@locator_instances_location, client)
47
54
  end
48
55
 
49
56
  end
@@ -34,19 +34,28 @@ module Gemfire
34
34
  super(location, client, InstallationImage, Group)
35
35
  end
36
36
 
37
+ # Reloads the installation's details from the server
38
+ # @return [void]
39
+ def reload
40
+ super
41
+ @agent_instances = nil
42
+ @cache_server_instances = nil
43
+ @locator_instances = nil
44
+ end
45
+
37
46
  # @return [AgentInstance[]] the agent instances that are using the installation
38
47
  def agent_instances
39
- retrieve_instances("agent-group-instance", AgentInstance);
48
+ @agent_instances ||= create_resources_from_links('agent-group-instance', AgentInstance);
40
49
  end
41
50
 
42
51
  # @return [CacheServerInstance[]] the cache server instances that are using the installation
43
52
  def cache_server_instances
44
- retrieve_instances("cache-server-group-instance", CacheServerInstance);
53
+ @cache_server_instances ||= create_resources_from_links('cache-server-group-instance', CacheServerInstance);
45
54
  end
46
55
 
47
56
  # @return [LocatorInstance[]] the locator instances that are using the installation
48
57
  def locator_instances
49
- retrieve_instances("locator-group-instance", LocatorInstance);
58
+ @locator_instances ||= create_resources_from_links('locator-group-instance', LocatorInstance);
50
59
  end
51
60
 
52
61
  end
@@ -16,12 +16,12 @@
16
16
 
17
17
  module Gemfire
18
18
 
19
- # Used to enumerate a cache server's live application code.
19
+ # Used to enumerate a cache server's live application code
20
20
  class LiveApplicationCodes < Shared::Collection
21
21
 
22
22
  # @private
23
23
  def initialize(location, client)
24
- super(location, client, "live-application-code", ApplicationCode)
24
+ super(location, client, 'live-application-code', ApplicationCode)
25
25
  end
26
26
 
27
27
  end
@@ -21,7 +21,7 @@ module Gemfire
21
21
 
22
22
  # @private
23
23
  def initialize(location, client)
24
- super(location, client, "locator-group-instances", LocatorInstance)
24
+ super(location, client, 'locator-group-instances', LocatorInstance)
25
25
  end
26
26
 
27
27
  # Creates a new locator instance
@@ -47,7 +47,7 @@ module Gemfire
47
47
  payload[:server] = options[:server]
48
48
  end
49
49
 
50
- LocatorInstance.new(client.post(location, payload, "locator-group-instance"), client)
50
+ super(payload, 'locator-group-instance')
51
51
  end
52
52
 
53
53
  end
@@ -55,11 +55,21 @@ module Gemfire
55
55
  # A locator instance
56
56
  class LocatorInstance < Shared::Instance
57
57
 
58
+ # @return [Integer] the port that the locator will listen on
59
+ attr_reader :port
60
+
61
+ # @return [Boolean] +true+ if the locator will act as a peer, +false+ if it will not
62
+ attr_reader :peer
63
+
64
+ # @return [Boolean] +true+ if the locator will act as a server, +false+ if it will not
65
+ attr_reader :server
66
+
58
67
  # @private
59
68
  def initialize(location, client)
60
69
  super(location, client, Group, Installation, LocatorLiveConfigurations, LocatorPendingConfigurations, LocatorNodeInstance, 'locator-node-instance')
61
70
  end
62
71
 
72
+
63
73
  # Updates the instance using the supplied +options+.
64
74
  #
65
75
  # @param options [Hash] optional configuration for the instance
@@ -92,21 +102,21 @@ module Gemfire
92
102
  end
93
103
 
94
104
  client.post(location, payload)
105
+ reload
95
106
  end
96
107
 
97
- # @return [Integer] the port that the locator will listen on
98
- def port
99
- client.get(location)['port']
100
- end
101
-
102
- # @return [Boolean] +true+ if the locator will act as a peer, +false+ if it will not
103
- def peer
104
- client.get(location)['peer']
108
+ # Reloads the instance's details from the server
109
+ # @return [void]
110
+ def reload
111
+ super
112
+ @port = details['port']
113
+ @peer = details['peer']
114
+ @server = details['server']
105
115
  end
106
116
 
107
- # @return [Boolean] +true+ if the locator will act as a server, +false+ if it will not
108
- def server
109
- client.get(location)['server']
117
+ # @return [String] a string representation of the instance
118
+ def to_s
119
+ "#<#{self.class} name=#{name} port='#@port' peer='#@peer' server='#@server'>"
110
120
  end
111
121
 
112
122
  end
@@ -21,17 +21,17 @@ module Gemfire
21
21
 
22
22
  # @private
23
23
  def initialize(location, client)
24
- super(location, client, "live-configurations", LocatorLiveConfiguration)
24
+ super(location, client, 'live-configurations', LocatorLiveConfiguration)
25
25
  end
26
26
 
27
27
  end
28
28
 
29
29
  # A live configuration file in a locator instance
30
- class LocatorLiveConfiguration < Shared::Configuration
30
+ class LocatorLiveConfiguration < Shared::LiveConfiguration
31
31
 
32
32
  # @private
33
33
  def initialize(location, client)
34
- super(location, client, "locator-group-instance", LocatorInstance)
34
+ super(location, client, 'locator-group-instance', LocatorInstance, LocatorNodeLiveConfiguration)
35
35
  end
36
36
 
37
37
  end
@@ -21,7 +21,7 @@ module Gemfire
21
21
 
22
22
  # @private
23
23
  def initialize(location, client)
24
- super(location, client, "locator-node-instances", LocatorNodeInstance)
24
+ super(location, client, 'locator-node-instances', LocatorNodeInstance)
25
25
  end
26
26
 
27
27
  end
@@ -29,24 +29,32 @@ module Gemfire
29
29
  # A locator node instance
30
30
  class LocatorNodeInstance < Shared::NodeInstance
31
31
 
32
- # @private
33
- def initialize(location, client) #:nodoc:
34
- super(location, client, Node, LocatorLogs, LocatorInstance, 'locator-group-instance')
35
- end
36
-
37
32
  # @return [Integer] the port that the locator will listen on
38
- def port
39
- client.get(location)['port']
40
- end
33
+ attr_reader :port
41
34
 
42
35
  # @return [Boolean] +true+ if the locator will act as a peer, +false+ if it will not
43
- def peer
44
- client.get(location)['peer']
45
- end
36
+ attr_reader :peer
46
37
 
47
38
  # @return [Boolean] +true+ if the locator will act as a server, +false+ if it will not
48
- def server
49
- client.get(location)['server']
39
+ attr_reader :server
40
+
41
+ # @private
42
+ def initialize(location, client)
43
+ super(location, client, Node, LocatorLogs, LocatorInstance, 'locator-group-instance', LocatorNodeLiveConfigurations)
44
+ end
45
+
46
+ # Reloads the instance's details from the server
47
+ # @return [void]
48
+ def reload
49
+ super
50
+ @port = details['port']
51
+ @peer = details['peer']
52
+ @server = details['server']
53
+ end
54
+
55
+ # @return [String] a string representation of the instance
56
+ def to_s
57
+ "#<#{self.class} name=#{name} port='#@port' peer='#@peer' server='#@server'>"
50
58
  end
51
59
 
52
60
  end
@@ -0,0 +1,39 @@
1
+ # vFabric Administration Server Ruby API
2
+ # Copyright (c) 2012 VMware, Inc. All Rights Reserved.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+
17
+ module Gemfire
18
+
19
+ # Used to enumerate a locator node instance's live configuration
20
+ class LocatorNodeLiveConfigurations < Shared::Collection
21
+
22
+ # @private
23
+ def initialize(location, client)
24
+ super(location, client, 'node-live-configurations', LocatorNodeLiveConfiguration)
25
+ end
26
+
27
+ end
28
+
29
+ # A live configuration file in a locator node instance
30
+ class LocatorNodeLiveConfiguration < Shared::NodeConfiguration
31
+
32
+ # @private
33
+ def initialize(location, client)
34
+ super(location, client, 'locator-node-instance', LocatorNodeInstance, LocatorLiveConfiguration)
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -21,7 +21,7 @@ module Gemfire
21
21
 
22
22
  # @private
23
23
  def initialize(location, client)
24
- super(location, client, "nodes", Node)
24
+ super(location, client, 'nodes', Node)
25
25
  end
26
26
 
27
27
  end
@@ -44,15 +44,36 @@ module Gemfire
44
44
  # @private
45
45
  def initialize(location, client)
46
46
  super(location, client, Group)
47
- @java_home = details["java-home"]
48
- @agent_instances = AgentNodeInstances.new(Util::LinkUtils.get_link_href(details, "agent-node-instances"), client)
49
- @cache_server_instances = CacheServerNodeInstances.new(Util::LinkUtils.get_link_href(details, "cache-server-node-instances"), client)
50
- @locator_instances = LocatorNodeInstances.new(Util::LinkUtils.get_link_href(details, "locator-node-instances"), client)
47
+ @agent_instances_location = Util::LinkUtils.get_link_href(details, 'agent-node-instances')
48
+ @cache_server_instances_location = Util::LinkUtils.get_link_href(details, 'cache-server-node-instances')
49
+ @locator_instances_location = Util::LinkUtils.get_link_href(details, 'locator-node-instances')
50
+ end
51
+
52
+ # Reloads the node's details from the server
53
+ # @return [void]
54
+ def reload
55
+ super
56
+ @java_home = details['java-home']
57
+ end
58
+
59
+ # @return [AgentNodeInstances] the node's agent instances
60
+ def agent_instances
61
+ @agent_instances ||= AgentNodeInstances.new(@agent_instances_location, client)
62
+ end
63
+
64
+ # @return [CacheServerNodeInstances] the node's server instances
65
+ def cache_server_instances
66
+ @cache_server_instances ||= CacheServerNodeInstances.new(@cache_server_instances_location, client)
67
+ end
68
+
69
+ # @return [LocatorNodeInstances] the node's locator instances
70
+ def locator_instances
71
+ @locator_instances ||= LocatorNodeInstances.new(@locator_instances_location, client)
51
72
  end
52
73
 
53
74
  # @return [String] a string representation of the node
54
75
  def to_s
55
- "#<#{self.class} host_names='#{host_names}' ip_addresses='#{ip_addresses}' operating_system='#{operating_system}' architecture='#{architecture}' agent_home='#{agent_home}' java_home='#{java_home}' metadata='#{metadata}'>"
76
+ "#<#{self.class} host_names='#{host_names}' ip_addresses='#{ip_addresses}' ipv4_addresses='#{ipv4_addresses}' ipv6_addresses='#{ipv6_addresses}' operating_system='#{operating_system}' architecture='#{architecture}' agent_home='#{agent_home}' java_home='#@java_home' metadata='#{metadata}'>"
56
77
  end
57
78
 
58
79
  end
@@ -21,7 +21,7 @@ module Gemfire
21
21
 
22
22
  # @private
23
23
  def initialize(location, client)
24
- super(location, client, "pending-application-code", ApplicationCode)
24
+ super(location, client, 'pending-application-code', PendingApplicationCode)
25
25
  end
26
26
 
27
27
  # Creates a new pending application code
@@ -30,9 +30,14 @@ module Gemfire
30
30
  #
31
31
  # @return [ApplicationCode] the new application code
32
32
  def create(image)
33
- ApplicationCode.new(client.post(location, { :image => image.location}), client)
33
+ super({:image => image.location})
34
34
  end
35
35
 
36
36
  end
37
+
38
+ # An application code that is pending
39
+ class PendingApplicationCode < ApplicationCode
40
+ include Shared::Deletable
41
+ end
37
42
 
38
43
  end
@@ -28,12 +28,17 @@ module Gemfire
28
28
 
29
29
  # A statistic of a cache server
30
30
  class Statistic < Shared::Resource
31
+
32
+ include Shared::Deletable
31
33
 
32
34
  # @return [String] the path of statistic
33
35
  attr_reader :path
34
36
 
35
- # @return [CacheServerNodeInstance] The statistic's cache server node instance
36
- attr_reader :instance
37
+ # @return [Integer] the size of the statistic
38
+ attr_reader :size
39
+
40
+ # @return [Integer] the last modified stamp of the statistic
41
+ attr_reader :last_modified
37
42
 
38
43
  # @private
39
44
  def initialize(location, client)
@@ -41,18 +46,20 @@ module Gemfire
41
46
 
42
47
  @path = details['path']
43
48
 
44
- @instance = CacheServerNodeInstance.new(Util::LinkUtils.get_link_href(details, 'cache-server-node-instance'), client)
49
+ @instance_location = Util::LinkUtils.get_link_href(details, 'cache-server-node-instance')
45
50
  @content_location = Util::LinkUtils.get_link_href(details, 'content')
46
51
  end
47
-
48
- # @return [Integer] the size of the statistic
49
- def size
50
- client.get(location)['size']
52
+
53
+ # Reloads the statistic's details from the server
54
+ def reload
55
+ super
56
+ @size = details['size']
57
+ @last_modified = details['last-modified']
51
58
  end
52
59
 
53
- # @return [Integer] the last modified stamp of the statistic
54
- def last_modified
55
- client.get(location)['last-modified']
60
+ # @return [CacheServerNodeInstance] The statistic's cache server node instance
61
+ def instance
62
+ @instance ||= CacheServerNodeInstance.new(@instance_location, client)
56
63
  end
57
64
 
58
65
  # Retrieves the statistic's content
@@ -66,7 +73,7 @@ module Gemfire
66
73
 
67
74
  # @return [String] a string representation of the statistic
68
75
  def to_s
69
- "#<#{self.class} path='#@path'>"
76
+ "#<#{self.class} path='#@path' size='#@size' last_modified='#@last_modified'>"
70
77
  end
71
78
 
72
79
  end