Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#160: First spike of karaf server tab.
- Loading branch information
Showing
4 changed files
with
98 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<div class="row-fluid" ng-controller="Karaf.ServerController"> | ||
|
||
<dl class="dl-horizontal"> | ||
<dt>Name</dt> | ||
<dd>{{data.name}}</dd> | ||
<dt>Version</dt> | ||
<dd>{{data.version}}</dd> | ||
<dt>State</dt> | ||
<dd>{{data.state}}</dd> | ||
<dt>Is root</dt> | ||
<dd>{{data.root}}</dd> | ||
<dt>Location</dt> | ||
<dd>{{data.location}}</dd> | ||
<dt>SSH Port</dt> | ||
<dd>{{data.sshPort}}</dd> | ||
<dt>RMI Registry Port</dt> | ||
<dd>{{data.rmiRegistryPort}}</dd> | ||
<dt>RMI Server Port</dt> | ||
<dd>{{data.rmiServerPort}}</dd> | ||
<dt>PID</dt> | ||
<dd>{{data.pid}}</dd> | ||
</dl> | ||
|
||
</div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
module Karaf { | ||
|
||
export function ServerController($scope, $location, workspace:Workspace, jolokia) { | ||
|
||
$scope.data = { | ||
name: "", | ||
version: "", | ||
state: "", | ||
root: "", | ||
location: "", | ||
sshPort: "", | ||
rmiRegistryPort: "", | ||
rmiServerPort: "", | ||
pid: ""}; | ||
|
||
function render(response) { | ||
console.log("Response is " + response); | ||
|
||
// grab the first mbean as there should ideally only be one karaf in the JVM | ||
if (angular.isArray(response)) { | ||
var mbean = response[0]; | ||
if (mbean) { | ||
var instances = jolokia.getAttribute(mbean, "Instances", onSuccess(null)); | ||
if (instances) { | ||
console.log("Instances is " + instances); | ||
// the name is the first child | ||
$scope.data.name = "TODO"; | ||
// TODO: we need to get version from another mbean | ||
$scope.data.version = "TODO"; | ||
$scope.data.state = instances['root'].State; | ||
$scope.data.root = "TODO"; | ||
$scope.data.location = instances['root'].Location; | ||
$scope.data.sshPort = "TODO"; | ||
$scope.data.rmiRegistryPort = "TODO"; | ||
$scope.data.rmiServerPort = "TODO"; | ||
$scope.data.pid = instances['root'].Pid; | ||
} | ||
} | ||
} | ||
|
||
// ensure web page is updated | ||
Core.$apply($scope); | ||
} | ||
|
||
// TODO: we need the framework and version from another mbean | ||
|
||
function loadData() { | ||
console.log("Loading Karaf data..."); | ||
jolokia.search("org.apache.karaf:type=admin,*", onSuccess(render)); | ||
} | ||
|
||
$scope.$on('jmxTreeUpdated', reloadFunction); | ||
$scope.$watch('workspace.tree', reloadFunction); | ||
|
||
function reloadFunction() { | ||
// if the JMX tree is reloaded its probably because a new MBean has been added or removed | ||
// so lets reload, asynchronously just in case | ||
setTimeout(loadData, 50); | ||
} | ||
} | ||
|
||
} |