rboss 0.6.2 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -26,12 +26,13 @@ print:
26
26
  threshold:
27
27
  0.8: intense_red
28
28
  0.7: red
29
- 0.5: brown
29
+ 0.5: yellow
30
30
  0: green
31
31
 
32
32
  - id: env
33
33
  title: Server Environment Information
34
34
  path: ${PATH}server-environment
35
+ layout: vertical
35
36
  properties:
36
37
  - server-name
37
38
  - node-name
@@ -48,18 +49,6 @@ print:
48
49
  server_name:
49
50
  with: white
50
51
 
51
- node_name:
52
- with: blue
53
-
54
- host_name:
55
- with: brown
56
-
57
- initial_running_mode:
58
- with: purple
59
-
60
- launch_type:
61
- with: cyan
62
-
63
52
  - id: memory
64
53
  title: Server Memory Usage
65
54
  layout: vertical
@@ -73,17 +62,24 @@ print:
73
62
  - non-heap-memory-usage -> used
74
63
  - non-heap-memory-usage -> committed
75
64
  - non-heap-memory-usage -> max
76
- - object-pending-finalization-count
77
65
  header:
78
- - Initial Heap
79
- - Used Heap
80
- - Committed Heap
81
- - Max Heap
82
- - Initial Non Heap
83
- - Used Non Heap
84
- - Committed Non Heap
85
- - Max Non Heap
86
- - Objects Pending Finalization
66
+ - "(Heap)\nInitial"
67
+ - "\nUsed"
68
+ - "\nCommitted"
69
+ - "\nMax"
70
+ - "(Non Heap)\nInitial"
71
+ - "\nUsed"
72
+ - "\nCommitted"
73
+ - "\nMax"
74
+ aliases:
75
+ - initial_heap
76
+ - used_heap
77
+ - committed_heap
78
+ - max_heap
79
+ - initial_non_heap
80
+ - used_non_heap
81
+ - committed_non_heap
82
+ - max_non_heap
87
83
  format:
88
84
  initial_heap: byte
89
85
  used_heap: byte
@@ -96,16 +92,10 @@ print:
96
92
 
97
93
  color:
98
94
  max_heap:
99
- with: intense_purple
95
+ with: white
100
96
 
101
97
  max_non_heap:
102
- with: intense_purple
103
-
104
- committed_heap:
105
- with: purple
106
-
107
- committed_non_heap:
108
- with: purple
98
+ with: white
109
99
 
110
100
  health:
111
101
  used_heap:
@@ -152,13 +142,13 @@ print:
152
142
  - CUrrent Thread User Time
153
143
 
154
144
  format:
155
- thread_contention_monitoring_supported: yes_or_no
156
- thread_cpu_time_supported: yes_or_no
157
- current_thread_cpu_time_supported: yes_or_no
158
- object_monitor_usage_supported: yes_or_no
159
- synchronizer_usage_supported: yes_or_no
160
- thread_contention_monitoring_enabled: yes_or_no
161
- thread_cpu_time_enabled: yes_or_no
145
+ thread_contention_monitoring_supported: boolean
146
+ thread_cpu_time_supported: boolean
147
+ current_thread_cpu_time_supported: boolean
148
+ object_monitor_usage_supported: boolean
149
+ synchronizer_usage_supported: boolean
150
+ thread_contention_monitoring_enabled: boolean
151
+ thread_cpu_time_enabled: boolean
162
152
 
163
153
  color:
164
154
  thread_contention_monitoring_supported: boolean
@@ -103,8 +103,8 @@ module RBoss
103
103
  end
104
104
  end
105
105
 
106
- table.format 'required', :using => RBoss::Formatters.yes_or_no
107
- table.colorize 'required', :using => RBoss::Colorizers.boolean
106
+ table.format 'required', :using => Yummi::Formatters.boolean
107
+ table.colorize 'required', :using => Yummi::Colorizers.boolean
108
108
  result["request-properties"] ||= {}
109
109
  unless result["request-properties"].empty?
110
110
  result["request-properties"].each do |name, detail|
@@ -127,8 +127,8 @@ module RBoss
127
127
  end
128
128
  end
129
129
 
130
- table.format 'nilable', :using => RBoss::Formatters.yes_or_no
131
- table.colorize 'nilable', :using => RBoss::Colorizers.boolean
130
+ table.format 'nilable', :using => Yummi::Formatters.boolean
131
+ table.colorize 'nilable', :using => Yummi::Colorizers.boolean
132
132
  result["reply-properties"] ||= {}
133
133
  unless result["reply-properties"].empty?
134
134
  result = result["reply-properties"]
@@ -143,9 +143,6 @@ module RBoss
143
143
  buff
144
144
  end
145
145
 
146
- alias_method :list_operations, :read_operation_names
147
- alias_method :detail_operation, :read_operation_description
148
-
149
146
  private
150
147
 
151
148
  def build_nested(detail, parent_name = '', result = [])
@@ -185,7 +182,7 @@ module RBoss
185
182
 
186
183
  def parse(value)
187
184
  return nil unless value
188
- result = value.scan /\$\{\w+\}/
185
+ result = value.scan(/\$\{\w+\}/)
189
186
  result.each do |matched|
190
187
  key = matched[2...-1].downcase.to_sym
191
188
  value = value.gsub(matched, @context[key].to_s)
@@ -69,7 +69,7 @@ module RBoss
69
69
 
70
70
  def eval_result(result)
71
71
  undefined = nil #prevents error because undefined means nil in result object
72
- result = result.gsub /(\d+)L/, '\1' #removes the long type mark
72
+ result = result.gsub(/(\d+)L/, '\1') #removes the long type mark
73
73
  result = eval(result)
74
74
  raise InvocationFailed::new(result["failure-description"]) if result["outcome"] == "failed"
75
75
  result["result"]
data/lib/rboss/twiddle.rb CHANGED
@@ -23,8 +23,3 @@
23
23
  require_relative 'twiddle/base_monitor'
24
24
  require_relative 'twiddle/mbean'
25
25
  require_relative 'twiddle/monitor'
26
-
27
- file = ENV["RBOSS_TWIDDLE"] || File.expand_path("~/.rboss/twiddle.rb")
28
-
29
- eval File.read(file), binding, file if File.exist? file
30
-
@@ -107,7 +107,7 @@ module RBoss
107
107
  result = @twiddle.execute(:get, query, property)
108
108
 
109
109
  def result.value
110
- self.split(/=/, 2)[1]
110
+ self.split( /=/, 2)[1]
111
111
  end
112
112
 
113
113
  result
data/lib/rboss/version.rb CHANGED
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module RBoss
24
- VERSION = "0.6.2"
24
+ VERSION = "0.7.0"
25
25
  end
@@ -1,23 +1,18 @@
1
1
  require 'yummi'
2
2
 
3
3
  module RBoss
4
- module Colorizers
5
-
6
- def self.boolean params = {}
7
- Yummi::to_colorize do |value|
8
- value ? (params[:if_true] or :green) : (params[:if_false] or :brown)
9
- end
10
- end
11
-
12
- def self.threshold params
13
- colorize = lambda do |value|
14
- params.sort.reverse_each do |limit, color|
15
- return color if value > limit
16
- end
17
- end
18
- Yummi::to_colorize &colorize
19
- end
20
4
 
5
+ #
6
+ # A module that holds the builtin colorizers
7
+ #
8
+ module Colorizers
9
+
10
+ #
11
+ # A colorizer for the types returned by invocations in jboss-cli.
12
+ #
13
+ # Parameter:
14
+ # The type to use the color
15
+ #
21
16
  def self.type type
22
17
  Yummi::to_colorize do |value|
23
18
  case type
@@ -34,11 +29,5 @@ module RBoss
34
29
  end
35
30
  end
36
31
 
37
- def self.with color
38
- Yummi::to_colorize do |value|
39
- color
40
- end
41
- end
42
-
43
32
  end
44
33
  end
@@ -1,21 +1,10 @@
1
1
  require 'yummi'
2
2
 
3
3
  module RBoss
4
+ #
5
+ # A module that holds the builtin formatters
6
+ #
4
7
  module Formatters
5
8
 
6
- def self.yes_or_no
7
- Yummi::Formatters.yes_or_no
8
- end
9
-
10
- def self.byte params = {}
11
- Yummi::Formatters.byte params
12
- end
13
-
14
- def self.percentage
15
- Yummi::to_format do |value|
16
- "%.2f%%" % (value * 100)
17
- end
18
- end
19
-
20
9
  end
21
10
  end
@@ -1,41 +1,10 @@
1
1
  require 'yummi'
2
2
 
3
3
  module RBoss
4
+ #
5
+ # A module that holds the builtin health checkers
6
+ #
4
7
  module HealthCheckers
5
8
 
6
- def self.percentage params
7
- PercentageColorizer::new params
8
- end
9
-
10
- class PercentageColorizer
11
-
12
- def initialize(params)
13
- @max = params[:max]
14
- @free = params[:free]
15
- @using = params[:using]
16
- @color = params[:color] || {
17
- :bad => :red,
18
- :warn => :brown,
19
- :good => :green
20
- }
21
- @threshold = params[:threshold] || {
22
- :warn => 0.30,
23
- :bad => 0.15
24
- }
25
- end
26
-
27
- def call(data)
28
- max = data[@max.to_sym].to_f
29
- free = @using ? max - data[@using.to_sym].to_f : data[@free.to_sym].to_f
30
-
31
- percentage = free / max
32
-
33
- return @color[:bad] if percentage <= @threshold[:bad]
34
- return @color[:warn] if percentage <= @threshold[:warn]
35
- @color[:good]
36
- end
37
-
38
- end
39
-
40
9
  end
41
10
  end
@@ -37,31 +37,24 @@ module RBoss
37
37
  end
38
38
 
39
39
  def build_table
40
- table = Yummi::Table::new
41
- table.title = (@config[:title] or @config[:description])
42
- header = @config[:header]
43
- header = [@name_column] + header if @name_column
40
+ if @name_column
41
+ @config[:header] = [] if @only_name
42
+ @config[:header] = [@name_column] + @config[:header]
43
+ end
44
+
44
45
  if @config[:aliases]
45
46
  aliases = @config[:aliases]
46
47
  aliases = [:name] + aliases if @name_column
47
- table.aliases = aliases
48
+ @config[:aliases] = aliases
48
49
  end
49
- table.header = header if header
50
- table.layout = @config[:layout].to_sym if @config[:layout]
51
50
 
52
- parse_component @config[:format], RBoss::Formatters do |column, params|
53
- table.format column, params
54
- end
55
- parse_component @config[:color], RBoss::Colorizers do |column, params|
56
- table.colorize column, params
57
- end
58
- parse_component @config[:health], RBoss::HealthCheckers do |column, params|
59
- table.using_row do
60
- table.colorize column, params
61
- end
62
- end
51
+ builder = Yummi::TableBuilder::new(@config).defaults
52
+
53
+ builder.repositories[:using_row_colorizers] << RBoss::HealthCheckers
54
+ builder.repositories[:colorizers] << RBoss::Colorizers
55
+ builder.repositories[:formatters] << RBoss::Formatters
63
56
 
64
- table.header = [@name_column] if @only_name
57
+ table = builder.build_table
65
58
 
66
59
  table.format_null :with => 'undefined'
67
60
  table.colorize_null :with => :red
@@ -70,24 +63,7 @@ module RBoss
70
63
 
71
64
  table
72
65
  end
73
-
74
- def parse_component(config, repository)
75
- if config
76
- config.each do |column, component_config|
77
- component = nil
78
- if component_config.is_a? Hash
79
- component = Yummi::GroupedComponent::new
80
- component_config.each do |component_name, params|
81
- component << repository.send(component_name, params)
82
- end
83
- else
84
- component = repository.send(component_config)
85
- end
86
- yield(column, :using => component)
87
- end
88
- end
89
- end
90
-
66
+
91
67
  end
92
68
 
93
69
  end
data/rboss.iml ADDED
@@ -0,0 +1,206 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
4
+ <exclude-output />
5
+ <content url="file://$MODULE_DIR$">
6
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
7
+ <sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" />
8
+ <sourceFolder url="file://$MODULE_DIR$/bin" isTestSource="false" />
9
+ <excludeFolder url="file://$MODULE_DIR$/pkg" />
10
+ </content>
11
+ <orderEntry type="jdk" jdkName="RVM: ruby-1.9.3-p194" jdkType="RUBY_SDK" />
12
+ <orderEntry type="sourceFolder" forTests="false" />
13
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v1.1.4, RVM: ruby-1.9.3-p194) [gem]" level="application" />
14
+ <orderEntry type="library" scope="PROVIDED" name="yummi (v0.4.2, RVM: ruby-1.9.3-p194) [gem]" level="application" />
15
+ </component>
16
+ <component name="org.twodividedbyzero.idea.findbugs">
17
+ <option name="_basePreferences">
18
+ <map>
19
+ <entry key="property.analysisEffortLevel" value="default" />
20
+ <entry key="property.analyzeAfterCompile" value="false" />
21
+ <entry key="property.exportAsHtml" value="true" />
22
+ <entry key="property.exportAsXml" value="true" />
23
+ <entry key="property.exportBaseDir" value="" />
24
+ <entry key="property.exportCreateArchiveDir" value="false" />
25
+ <entry key="property.exportOpenBrowser" value="true" />
26
+ <entry key="property.minPriorityToReport" value="Medium" />
27
+ <entry key="property.runAnalysisInBackground" value="false" />
28
+ <entry key="property.showHiddenDetectors" value="false" />
29
+ <entry key="property.toolWindowToFront" value="true" />
30
+ </map>
31
+ </option>
32
+ <option name="_detectors">
33
+ <map>
34
+ <entry key="AppendingToAnObjectOutputStream" value="true" />
35
+ <entry key="BCPMethodReturnCheck" value="false" />
36
+ <entry key="BadAppletConstructor" value="false" />
37
+ <entry key="BadResultSetAccess" value="true" />
38
+ <entry key="BadSyntaxForRegularExpression" value="true" />
39
+ <entry key="BadUseOfReturnValue" value="true" />
40
+ <entry key="BadlyOverriddenAdapter" value="true" />
41
+ <entry key="BooleanReturnNull" value="true" />
42
+ <entry key="BuildInterproceduralCallGraph" value="false" />
43
+ <entry key="BuildObligationPolicyDatabase" value="true" />
44
+ <entry key="CallToUnsupportedMethod" value="false" />
45
+ <entry key="CalledMethods" value="true" />
46
+ <entry key="CheckCalls" value="false" />
47
+ <entry key="CheckExpectedWarnings" value="false" />
48
+ <entry key="CheckImmutableAnnotation" value="true" />
49
+ <entry key="CheckTypeQualifiers" value="true" />
50
+ <entry key="CloneIdiom" value="true" />
51
+ <entry key="ComparatorIdiom" value="true" />
52
+ <entry key="ConfusedInheritance" value="true" />
53
+ <entry key="ConfusionBetweenInheritedAndOuterMethod" value="true" />
54
+ <entry key="CrossSiteScripting" value="true" />
55
+ <entry key="DoInsideDoPrivileged" value="true" />
56
+ <entry key="DontCatchIllegalMonitorStateException" value="true" />
57
+ <entry key="DontIgnoreResultOfPutIfAbsent" value="true" />
58
+ <entry key="DontUseEnum" value="true" />
59
+ <entry key="DroppedException" value="true" />
60
+ <entry key="DumbMethodInvocations" value="true" />
61
+ <entry key="DumbMethods" value="true" />
62
+ <entry key="DuplicateBranches" value="true" />
63
+ <entry key="EmptyZipFileEntry" value="true" />
64
+ <entry key="EqStringTest" value="false" />
65
+ <entry key="EqualsOperandShouldHaveClassCompatibleWithThis" value="true" />
66
+ <entry key="FieldItemSummary" value="true" />
67
+ <entry key="FinalizerNullsFields" value="true" />
68
+ <entry key="FindBadCast" value="false" />
69
+ <entry key="FindBadCast2" value="true" />
70
+ <entry key="FindBadEqualsImplementation" value="false" />
71
+ <entry key="FindBadForLoop" value="true" />
72
+ <entry key="FindBugsSummaryStats" value="true" />
73
+ <entry key="FindCircularDependencies" value="false" />
74
+ <entry key="FindDeadLocalStores" value="true" />
75
+ <entry key="FindDoubleCheck" value="true" />
76
+ <entry key="FindEmptySynchronizedBlock" value="true" />
77
+ <entry key="FindFieldSelfAssignment" value="true" />
78
+ <entry key="FindFinalizeInvocations" value="true" />
79
+ <entry key="FindFloatEquality" value="true" />
80
+ <entry key="FindFloatMath" value="false" />
81
+ <entry key="FindHEmismatch" value="true" />
82
+ <entry key="FindInconsistentSync2" value="true" />
83
+ <entry key="FindJSR166LockMonitorenter" value="true" />
84
+ <entry key="FindLocalSelfAssignment2" value="true" />
85
+ <entry key="FindMaskedFields" value="true" />
86
+ <entry key="FindMismatchedWaitOrNotify" value="true" />
87
+ <entry key="FindNakedNotify" value="true" />
88
+ <entry key="FindNonSerializableStoreIntoSession" value="true" />
89
+ <entry key="FindNonSerializableValuePassedToWriteObject" value="true" />
90
+ <entry key="FindNonShortCircuit" value="true" />
91
+ <entry key="FindNullDeref" value="true" />
92
+ <entry key="FindNullDerefsInvolvingNonShortCircuitEvaluation" value="true" />
93
+ <entry key="FindOpenStream" value="true" />
94
+ <entry key="FindPuzzlers" value="true" />
95
+ <entry key="FindRefComparison" value="true" />
96
+ <entry key="FindReturnRef" value="true" />
97
+ <entry key="FindRunInvocations" value="true" />
98
+ <entry key="FindSelfComparison" value="true" />
99
+ <entry key="FindSelfComparison2" value="true" />
100
+ <entry key="FindSleepWithLockHeld" value="true" />
101
+ <entry key="FindSpinLoop" value="true" />
102
+ <entry key="FindSqlInjection" value="true" />
103
+ <entry key="FindTwoLockWait" value="true" />
104
+ <entry key="FindUncalledPrivateMethods" value="true" />
105
+ <entry key="FindUnconditionalWait" value="true" />
106
+ <entry key="FindUninitializedGet" value="true" />
107
+ <entry key="FindUnrelatedTypesInGenericContainer" value="true" />
108
+ <entry key="FindUnreleasedLock" value="true" />
109
+ <entry key="FindUnsatisfiedObligation" value="true" />
110
+ <entry key="FindUnsyncGet" value="true" />
111
+ <entry key="FindUselessControlFlow" value="true" />
112
+ <entry key="FormatStringChecker" value="true" />
113
+ <entry key="HugeSharedStringConstants" value="true" />
114
+ <entry key="IDivResultCastToDouble" value="true" />
115
+ <entry key="IncompatMask" value="true" />
116
+ <entry key="InconsistentAnnotations" value="true" />
117
+ <entry key="InefficientMemberAccess" value="false" />
118
+ <entry key="InefficientToArray" value="true" />
119
+ <entry key="InfiniteLoop" value="true" />
120
+ <entry key="InfiniteRecursiveLoop" value="true" />
121
+ <entry key="InfiniteRecursiveLoop2" value="false" />
122
+ <entry key="InheritanceUnsafeGetResource" value="true" />
123
+ <entry key="InitializationChain" value="true" />
124
+ <entry key="InstantiateStaticClass" value="true" />
125
+ <entry key="InvalidJUnitTest" value="true" />
126
+ <entry key="IteratorIdioms" value="true" />
127
+ <entry key="LazyInit" value="true" />
128
+ <entry key="LoadOfKnownNullValue" value="true" />
129
+ <entry key="LockedFields" value="false" />
130
+ <entry key="LostLoggerDueToWeakReference" value="true" />
131
+ <entry key="MethodReturnCheck" value="true" />
132
+ <entry key="Methods" value="true" />
133
+ <entry key="MultithreadedInstanceAccess" value="true" />
134
+ <entry key="MutableLock" value="true" />
135
+ <entry key="MutableStaticFields" value="true" />
136
+ <entry key="Naming" value="true" />
137
+ <entry key="Noise" value="false" />
138
+ <entry key="NoiseNullDeref" value="false" />
139
+ <entry key="NoteAnnotationRetention" value="true" />
140
+ <entry key="NoteCheckReturnValue" value="true" />
141
+ <entry key="NoteCheckReturnValueAnnotations" value="true" />
142
+ <entry key="NoteDirectlyRelevantTypeQualifiers" value="true" />
143
+ <entry key="NoteJCIPAnnotation" value="true" />
144
+ <entry key="NoteNonNullAnnotations" value="true" />
145
+ <entry key="NoteNonnullReturnValues" value="true" />
146
+ <entry key="NoteSuppressedWarnings" value="true" />
147
+ <entry key="NoteUnconditionalParamDerefs" value="true" />
148
+ <entry key="NumberConstructor" value="true" />
149
+ <entry key="OverridingEqualsNotSymmetrical" value="true" />
150
+ <entry key="PreferZeroLengthArrays" value="true" />
151
+ <entry key="PublicSemaphores" value="false" />
152
+ <entry key="QuestionableBooleanAssignment" value="true" />
153
+ <entry key="ReadOfInstanceFieldInMethodInvokedByConstructorInSuperclass" value="true" />
154
+ <entry key="ReadReturnShouldBeChecked" value="true" />
155
+ <entry key="RedundantInterfaces" value="true" />
156
+ <entry key="ReflectiveClasses" value="true" />
157
+ <entry key="RepeatedConditionals" value="true" />
158
+ <entry key="ResolveAllReferences" value="false" />
159
+ <entry key="RuntimeExceptionCapture" value="true" />
160
+ <entry key="SerializableIdiom" value="true" />
161
+ <entry key="StartInConstructor" value="true" />
162
+ <entry key="StaticCalendarDetector" value="true" />
163
+ <entry key="StringConcatenation" value="true" />
164
+ <entry key="SuperfluousInstanceOf" value="true" />
165
+ <entry key="SuspiciousThreadInterrupted" value="true" />
166
+ <entry key="SwitchFallthrough" value="true" />
167
+ <entry key="SynchronizationOnSharedBuiltinConstant" value="true" />
168
+ <entry key="SynchronizeAndNullCheckField" value="true" />
169
+ <entry key="SynchronizeOnClassLiteralNotGetClass" value="true" />
170
+ <entry key="SynchronizingOnContentsOfFieldToProtectField" value="true" />
171
+ <entry key="TestASM" value="false" />
172
+ <entry key="TestDataflowAnalysis" value="false" />
173
+ <entry key="TestingGround" value="false" />
174
+ <entry key="TrainFieldStoreTypes" value="true" />
175
+ <entry key="TrainNonNullAnnotations" value="true" />
176
+ <entry key="TrainUnconditionalDerefParams" value="true" />
177
+ <entry key="URLProblems" value="true" />
178
+ <entry key="UncallableMethodOfAnonymousClass" value="true" />
179
+ <entry key="UnnecessaryMath" value="true" />
180
+ <entry key="UnreadFields" value="true" />
181
+ <entry key="UseObjectEquals" value="false" />
182
+ <entry key="UselessSubclassMethod" value="false" />
183
+ <entry key="VarArgsProblems" value="true" />
184
+ <entry key="VolatileUsage" value="true" />
185
+ <entry key="WaitInLoop" value="true" />
186
+ <entry key="WrongMapIterator" value="true" />
187
+ <entry key="XMLFactoryBypass" value="true" />
188
+ </map>
189
+ </option>
190
+ <option name="_reportCategories">
191
+ <map>
192
+ <entry key="BAD_PRACTICE" value="true" />
193
+ <entry key="CORRECTNESS" value="true" />
194
+ <entry key="EXPERIMENTAL" value="true" />
195
+ <entry key="I18N" value="true" />
196
+ <entry key="MALICIOUS_CODE" value="true" />
197
+ <entry key="MT_CORRECTNESS" value="true" />
198
+ <entry key="NOISE" value="false" />
199
+ <entry key="PERFORMANCE" value="true" />
200
+ <entry key="SECURITY" value="true" />
201
+ <entry key="STYLE" value="true" />
202
+ </map>
203
+ </option>
204
+ </component>
205
+ </module>
206
+