- /** Wraps the execution modules of an agent. */
- static class AgentNodesWrapper extends NodesWrapper {
-
- public AgentNodesWrapper(Node node) {
- super(node);
- }
-
- protected List<WrappedNode> getWrappedNodes()
- throws RepositoryException {
- List<WrappedNode> children = new ArrayList<WrappedNode>();
- Node executionModules = getNode().getNode(
- SlcNames.SLC_EXECUTION_MODULES);
- for (NodeIterator nit = executionModules.getNodes(); nit.hasNext();) {
- for (NodeIterator nitVersions = nit.nextNode().getNodes(); nitVersions
- .hasNext();) {
- children.add(new WrappedNode(this, nitVersions.nextNode()));
- }
- }
- return children;
- }
-
- }
-
- class VmAgentObserver implements EventListener {
-
- public void onEvent(EventIterator events) {
+ // /** Wraps the execution modules of an agent. */
+ // static class AgentNodesWrapper extends NodesWrapper {
+ //
+ // public AgentNodesWrapper(Node node) {
+ // super(node);
+ // }
+ //
+ // protected List<WrappedNode> getWrappedNodes()
+ // throws RepositoryException {
+ // List<WrappedNode> children = new ArrayList<WrappedNode>();
+ // Node executionModules = getNode();
+ // for (NodeIterator nit = executionModules.getNodes(); nit.hasNext();) {
+ // for (NodeIterator nitVersions = nit.nextNode().getNodes(); nitVersions
+ // .hasNext();) {
+ // children.add(new WrappedNode(this, nitVersions.nextNode()));
+ // }
+ // }
+ // return children;
+ // }
+ //
+ // }
+
+ class VmAgentObserver extends AsyncUiEventListener {
+ protected void onEventInUiThread(EventIterator events) {
+// List<Node> baseNodes = ((SimpleNodeContentProvider) viewer
+// .getContentProvider()).getBaseNodes();
+// Node baseNode = baseNodes.get(0);
+//
+// while (events.hasNext()) {
+// Event event = events.nextEvent();
+// try {
+// String path = event.getPath();
+// String baseNodePath = baseNode.getPath();
+// if (path.startsWith(baseNodePath)) {
+// String relPath = path
+// .substring(baseNodePath.length() + 1);
+// log.debug("relPath: " + relPath);
+// if (baseNode.hasNode(relPath)) {
+// Node refreshNode = baseNode.getNode(relPath);
+// log.debug("refreshNode: " + refreshNode);
+// viewer.refresh(refreshNode);
+// }
+//
+// }
+// // if (log.isDebugEnabled())
+// // log.debug("Process " + path + ": " + event);
+//
+// // if (session.itemExists(path)) {
+// // Node parentNode = session.getNode(path).getParent();
+// // log.debug("Parent: " + parentNode);
+// // viewer.refresh(parentNode);
+// // }
+// } catch (RepositoryException e) {
+// log.warn("Cannot process event " + event + ": " + e);
+// }
+// }
+
+ // try {
+ // Node vmAgentNode = session
+ // .getNode(SlcJcrConstants.VM_AGENT_FACTORY_PATH);
+ // viewer.refresh(vmAgentNode);
+ // } catch (RepositoryException e) {
+ // log.warn("Cannot process event : " + e);
+ // }
+ // TODO: optimize based on event