Permalink
Browse files

Worked on.

  • Loading branch information...
1 parent 8dda5a9 commit 8023098a728054175e5992e63a434ac57c26c011 @rhuss committed Jul 10, 2012
View
2 pom.xml
@@ -198,7 +198,7 @@
</dependencyManagement>
<properties>
- <jolokia.version>1.0.2</jolokia.version>
+ <jolokia.version>1.0.5-SNAPSHOT</jolokia.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.host.url>http://labs.consol.de/sonar</sonar.host.url>
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
View
86 war/src/main/coffeescript/aji/jolokia.coffee
@@ -1,5 +1,5 @@
###
- Copyright 2009-2011 Roland Huss
+ Copyright 2009-2012 Roland Huss
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -40,89 +40,41 @@ define(["jolokia-simple","underscore"], (Jolokia,_) ->
# Interval between two refreshes, in seconds
pollPeriod : 5 * 60
- # Id of timer
- timerId : null
-
- # State of this client: "paused", "running"
- state : "paused"
-
# Constructor requiring as single argument the jolokia
# client.
constructor: (url) -> @j4p = new Jolokia(url)
# Register a request which gets polled periodically
- registerRequest : (callback, request...) ->
+ register : (callback, request...) ->
throw "At a least one request must be provided" if arguments.length < 2
- if (typeof callback is 'object')
- success_cb = callback.success
- error_cb = callback.error
- else if (typeof callback is 'function')
- success_cb = callback
- error_cb = null
- else
- throw "First argument must be either a callback func " +
- "or an object with 'success' and 'error' attrs"
-
- handle = @requests.length
- @requests[handle] =
- success : success_cb
- error : error_cb
- requests : arguments[1..]
- handle
+ @j4p.register.apply(callback,arguments[1..])
# Unregister a request
- unregisterRequest: (handle) -> @requests[handle] = null
-
- # Nuke all empty requests
- compressRequests: -> @requests = _.filter(@requests, (req) -> req != null)
-
- callJolokia: ->
- success_cbs = []
- error_cbs = []
- requests = []
- for job in @requests
- for req in job?.requests
- requests.push(req)
- success_cbs.push(job.success)
- error_cbs.push(job.error)
-
- opts =
- success: (resp, i) -> success_cbs[i].apply(this, resp)
- error: (resp, i) -> error_cbs[i].apply(this, resp) if error_cbs[i] != null
-
- @j4p.request(requests, opts)
-
- # Start poller
- start: (pollInterval) ->
- interval = pollInterval or @pollPeriod
- if (@running())
- return if interval is @pollPeriod
- @stop()
-
- @timerId = setInterval(@callJolokia, @pollPeriod)
- @state = "running"
-
- # Stop poller;
- stop: ->
- return if not @running()
- clearInterval(@timerId)
- @timerId = null
- @state = "stopped"
-
- running: -> @state is "running"
-
- mBeans: (force) ->
+ unregister : (handle) ->
+ @j4p.unregister(handle)
+
+ # Poller lifecycle methods
+ start : (pollInterval) ->
+ @j4p.start(pollInterval or @pollPeriod)
+
+ stop : ->
+ @j4p.stop()
+
+ isRunning : ->
+ @j4p.isRunning()
+
+ mBeans : (force) ->
@mbeanCache = @j4p.list(null, {maxDepth : 2}) if !@mbeanCache or force
@mbeanCache
- mBeanNames: (force) ->
+ mBeanNames : (force) ->
names = []
for domain, value of @mBeans(force)
for props of value
names.push(domain + ":" + props)
names.sort()
- filterNames: (term, force) ->
+ filterNames : (term, force) ->
regexp = new RegExp(term, "i")
_.filter(@mBeanNames(force), (elem) -> regexp.test(elem))
View
2 war/src/main/coffeescript/aji/mbean/MBeanView.coffee
@@ -30,7 +30,7 @@ define(["backbone","underscore","jquery","aji/mediator","aji/jolokia","aji/Templ
name: 'CompositeData'
handler: compositeDataHandler
'javax.management.openmbean.TabularData':
- name: 'TabularData'
+ name: 'TabularData'
handler: compositeDataHandler
arrayRegexp: /^\s*\[L(.*);\s*$/
View
4 war/src/main/javascript/aji/jolokia-client.js
@@ -52,7 +52,7 @@ define(["jquery","jolokia/jolokia-simple"], function ($,Jolokia) {
// State of this client: "paused", "running"
this.state = "paused";
- this.registerRequest = function (callback, request) {
+ this.register = function (callback, request) {
if (arguments.length < 2) {
throw "At a least a request must be provided";
}
@@ -76,7 +76,7 @@ define(["jquery","jolokia/jolokia-simple"], function ($,Jolokia) {
return handle;
};
- this.unregisterRequest = function (handle) {
+ this.unregister = function (handle) {
this.requests[handle] = null;
};
View
2 war/src/main/javascript/main.js
@@ -33,7 +33,7 @@ curl({
function(Backbone,TemplateManager,AppRouter) {
TemplateManager.loadTemplates(['header','mbean'],
function () {
- app = new AppRouter();
+ var app = new AppRouter();
Backbone.history.start();
});
View
2 war/src/main/webapp/WEB-INF/web.xml
@@ -5,7 +5,7 @@
<display-name>JSON JMX Agent</display-name>
- <!-- A dispatch filter for proper deliverying JS script files -->
+ <!-- A dispatch filter for proper delivering JS script files -->
<filter>
<filter-name>dispatch-filter</filter-name>
<filter-class>org.jolokia.aji.DispatchFilter</filter-class>
View
2 war/src/main/webapp/app/index.html
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
- <title>Bootstrap, from Twitter</title>
+ <title>Aji - JMX in the Browser</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">

0 comments on commit 8023098

Please sign in to comment.