summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-02-01 17:54:44 -0500
committerBernard Normier <bernard@zeroc.com>2017-02-01 17:54:44 -0500
commitc4e0e98695943c39f6eb4d3251eb43c90f47c10b (patch)
tree31235fc2f626389f252123b50e6deb392cd89e7a /java/src
parentAdd --no-warn option to Slice compilers (diff)
downloadice-c4e0e98695943c39f6eb4d3251eb43c90f47c10b.tar.bz2
ice-c4e0e98695943c39f6eb4d3251eb43c90f47c10b.tar.xz
ice-c4e0e98695943c39f6eb4d3251eb43c90f47c10b.zip
Refactored live deployment view, see ICE-5821
Added support for metrics, properties, Ice log to Registry, Slaves, Nodes.
Diffstat (limited to 'java/src')
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Communicator.java333
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java109
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListArrayTreeNode.java146
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListTreeNode.java88
-rwxr-xr-xjava/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java207
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java38
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java37
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java96
-rwxr-xr-xjava/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java241
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java120
-rwxr-xr-xjava/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java227
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java101
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java45
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java11
-rw-r--r--java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java5
15 files changed, 746 insertions, 1058 deletions
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Communicator.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Communicator.java
new file mode 100644
index 00000000000..3283270db4c
--- /dev/null
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Communicator.java
@@ -0,0 +1,333 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package com.zeroc.IceGridGUI.LiveDeployment;
+
+import java.util.Enumeration;
+
+import javax.swing.SwingUtilities;
+import com.zeroc.IceGridGUI.*;
+
+abstract public class Communicator extends TreeNode
+{
+ Communicator(TreeNode parent, String id, int arraySize)
+ {
+ super(parent, id);
+ _childrenArray = new java.util.List[arraySize];
+ }
+
+ //
+ // Children-related overrides
+ //
+ @Override
+ public Enumeration<Object> children()
+ {
+ return new Enumeration<Object>()
+ {
+ @Override
+ public boolean hasMoreElements()
+ {
+ if(_p.hasNext())
+ {
+ return true;
+ }
+
+ while(++_index < _childrenArray.length)
+ {
+ _p = _childrenArray[_index].iterator();
+ if(_p.hasNext())
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public Object nextElement()
+ {
+ try
+ {
+ return _p.next();
+ }
+ catch(java.util.NoSuchElementException nse)
+ {
+ if(hasMoreElements())
+ {
+ return _p.next();
+ }
+ else
+ {
+ throw nse;
+ }
+ }
+ }
+
+ private int _index = 0;
+ private java.util.Iterator _p = _childrenArray[0].iterator();
+ };
+ }
+
+ @Override
+ public boolean getAllowsChildren()
+ {
+ return true;
+ }
+
+ @Override
+ public javax.swing.tree.TreeNode getChildAt(int childIndex)
+ {
+ if(childIndex < 0)
+ {
+ throw new ArrayIndexOutOfBoundsException(childIndex);
+ }
+ int offset = 0;
+ for(java.util.List l : _childrenArray)
+ {
+ if(childIndex < offset + l.size())
+ {
+ return (javax.swing.tree.TreeNode)l.get(childIndex - offset);
+ }
+ else
+ {
+ offset += l.size();
+ }
+ }
+ throw new ArrayIndexOutOfBoundsException(childIndex);
+ }
+
+ @Override
+ public int getChildCount()
+ {
+ int result = 0;
+ for(java.util.List l : _childrenArray)
+ {
+ result += l.size();
+ }
+ return result;
+ }
+
+ @Override
+ public int getIndex(javax.swing.tree.TreeNode node)
+ {
+ int offset = 0;
+ for(java.util.List l : _childrenArray)
+ {
+ int index = l.indexOf(node);
+ if(index == -1)
+ {
+ offset += l.size();
+ }
+ else
+ {
+ return offset + index;
+ }
+ }
+ return -1;
+ }
+
+ @Override
+ public boolean isLeaf()
+ {
+ for(java.util.List l : _childrenArray)
+ {
+ if(!l.isEmpty())
+ {
+ return false;
+ }
+ }
+ return true;
+ }
+
+
+ //
+ // TreeNode overrides
+ //
+ @Override
+ public void retrieveIceLog()
+ {
+ if(_showIceLogDialog == null)
+ {
+ final String prefix = "Opening Ice Log file for " + getServerDisplayName() + "...";
+
+ forwardToAdmin(prefix, (admin) ->
+ {
+ final com.zeroc.Ice.LoggerAdminPrx loggerAdmin =
+ com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(admin.ice_facet("Logger"));
+ final String title = getDisplayName() + " Ice log";
+ final String defaultFileName = getDefaultFileName();
+
+ SwingUtilities.invokeLater(() ->
+ {
+ success(prefix);
+ if(_showIceLogDialog == null)
+ {
+ _showIceLogDialog = new ShowIceLogDialog(Communicator.this, title, loggerAdmin,
+ defaultFileName,
+ getRoot().getLogMaxLines(),
+ getRoot().getLogInitialLines());
+ }
+ else
+ {
+ _showIceLogDialog.toFront();
+ }
+ });
+ });
+ }
+ else
+ {
+ _showIceLogDialog.toFront();
+ }
+ }
+
+ @Override
+ public void clearShowIceLogDialog()
+ {
+ _showIceLogDialog = null;
+ }
+
+ protected void showRuntimeProperties()
+ {
+ final String prefix = "Retrieving properties for " + getDisplayName() + "...";
+ forwardToAdmin(prefix, (admin) ->
+ {
+ final com.zeroc.Ice.PropertiesAdminPrx propertiesAdmin =
+ com.zeroc.Ice.PropertiesAdminPrx.uncheckedCast(admin.ice_facet("Properties"));
+
+ propertiesAdmin.getPropertiesForPrefixAsync("").whenComplete((result, ex) ->
+ {
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ success(prefix);
+ ((CommunicatorEditor)getEditor()).setRuntimeProperties(
+ (java.util.SortedMap<String, String>)result, Communicator.this);
+ });
+ }
+ else
+ {
+ amiFailure(prefix, "Failed to retrieve the properties for " + getDisplayName(), ex);
+ }
+ });
+ });
+ }
+
+ protected void fetchMetricsViewNames()
+ {
+ if(_metricsRetrieved)
+ {
+ return; // Already loaded.
+ }
+ _metricsRetrieved = true;
+
+ final String prefix = "Retrieving metrics for " + getDisplayName() + "...";
+ if(!forwardToAdmin(prefix, (admin) ->
+ {
+ final com.zeroc.IceMX.MetricsAdminPrx metricsAdmin =
+ com.zeroc.IceMX.MetricsAdminPrx.uncheckedCast(admin.ice_facet("Metrics"));
+
+ metricsAdmin.getMetricsViewNamesAsync().whenComplete((result, ex) ->
+ {
+ if(ex == null)
+ {
+ SwingUtilities.invokeLater(() ->
+ {
+ success(prefix);
+ _metrics.clear();
+ for(String name : result.returnValue)
+ {
+ insertSortedChild(
+ new MetricsView(Communicator.this, name, metricsAdmin, true), _metrics, null);
+ }
+ for(String name : result.disabledViews)
+ {
+ insertSortedChild(
+ new MetricsView(Communicator.this, name, metricsAdmin, false), _metrics, null);
+ }
+ getRoot().getTreeModel().nodeStructureChanged(this);
+ });
+ }
+ else
+ {
+ amiFailure(prefix, "Failed to retrieve the metrics for " + getDisplayName(), ex);
+ }
+ });
+ }))
+ {
+ _metricsRetrieved = false;
+ }
+ }
+
+ void updateMetrics()
+ {
+ _metricsRetrieved = false;
+ if(getRoot().getTree().isExpanded(getPath()))
+ {
+ fetchMetricsViewNames();
+ }
+ }
+
+ public java.util.List<MetricsView>
+ getMetrics()
+ {
+ return new java.util.ArrayList<>(_metrics);
+ }
+
+ protected abstract java.util.concurrent.CompletableFuture<com.zeroc.Ice.ObjectPrx> getAdminAsync();
+ protected abstract String getDisplayName();
+ protected String getServerDisplayName()
+ {
+ return getDisplayName();
+ }
+ protected abstract String getDefaultFileName();
+
+
+ private boolean forwardToAdmin(final String prefix, final java.util.function.Consumer<com.zeroc.Ice.ObjectPrx> consumer)
+ {
+ getRoot().getCoordinator().getStatusBar().setText(prefix);
+ try
+ {
+ getAdminAsync().whenComplete((admin, adminEx) ->
+ {
+ if(adminEx == null && admin != null)
+ {
+ try
+ {
+ consumer.accept(admin);
+ }
+ catch(com.zeroc.Ice.LocalException e)
+ {
+ SwingUtilities.invokeLater(() -> getRoot().getCoordinator().getStatusBar().setText(prefix + " " + e.toString() + "."));
+ }
+ }
+ else if(adminEx != null)
+ {
+ amiFailure(prefix, "Failed to retrieve the Admin proxy for " + getServerDisplayName(), adminEx);
+ }
+ else
+ {
+ SwingUtilities.invokeLater(() -> getRoot().getCoordinator().getStatusBar().setText(prefix + " Admin not available."));
+ }
+ });
+ }
+ catch(com.zeroc.Ice.LocalException e)
+ {
+ getRoot().getCoordinator().getStatusBar().setText(prefix + " " + e.toString() + ".");
+ return false;
+ }
+ return true;
+ }
+
+ protected ShowIceLogDialog _showIceLogDialog;
+ protected java.util.List<MetricsView> _metrics = new java.util.LinkedList<>();
+ protected boolean _metricsRetrieved = false;
+
+ protected final java.util.List[] _childrenArray;
+}
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java
index 8a9ddd62a09..99f512d10a5 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/CommunicatorEditor.java
@@ -9,8 +9,15 @@
package com.zeroc.IceGridGUI.LiveDeployment;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JComponent;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
+import javax.swing.JTextField;
import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.jgoodies.forms.layout.CellConstraints;
@@ -24,17 +31,79 @@ class CommunicatorEditor extends Editor
{
_description.setEditable(false);
_description.setOpaque(false);
+
+ _buildId.setEditable(false);
+
+ Action refresh = new AbstractAction("Refresh")
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ _buildId.setText("");
+ _runtimeProperties.clear();
+ _target.showRuntimeProperties();
+ }
+ };
+ refresh.putValue(Action.SHORT_DESCRIPTION, "Retrieve again the properties");
+ _refreshButton = new JButton(refresh);
}
protected void show(CommunicatorDescriptor descriptor, java.util.SortedMap<String, String> properties,
Utils.Resolver resolver)
{
_description.setText(resolver.substitute(descriptor.description));
- _properties.setSortedMap(properties);
+ _descriptorProperties.setSortedMap(properties);
+ }
+
+ protected void clearRuntimeProperties(String buildId)
+ {
+ _buildId.setText(buildId);
+ _runtimeProperties.clear();
+ _runtimePropertiesRetrieved = false;
+ _refreshButton.setEnabled(false);
}
- @Override
- protected void appendProperties(DefaultFormBuilder builder)
+ protected void showRuntimeProperties(Communicator previous)
+ {
+ if(_target != previous || !_runtimePropertiesRetrieved)
+ {
+ _buildId.setText("Retrieving...");
+ _runtimeProperties.clear();
+
+ //
+ // Retrieve all properties in background
+ //
+ _target.showRuntimeProperties();
+ _runtimePropertiesRetrieved = true; // set to true immediately to avoid 'spinning'
+ }
+
+ _refreshButton.setEnabled(true);
+ }
+
+
+ void setRuntimeProperties(java.util.SortedMap<String, String> map, Communicator communicator)
+ {
+ if(communicator == _target)
+ {
+ _runtimeProperties.setSortedMap(map);
+ _runtimePropertiesRetrieved = true;
+
+ String buildString = map.get("BuildId");
+ if(buildString == null)
+ {
+ _buildId.setText("");
+ }
+ else
+ {
+ _buildId.setText(buildString);
+ }
+ }
+ //
+ // Otherwise we've already moved on
+ //
+ }
+
+ protected void appendDescriptorProperties(DefaultFormBuilder builder)
{
builder.append("Description");
builder.nextLine();
@@ -57,12 +126,42 @@ class CommunicatorEditor extends Editor
builder.append("");
builder.nextRow(-6);
- scrollPane = new JScrollPane(_properties);
+ scrollPane = new JScrollPane(_descriptorProperties);
builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
}
+ protected void appendRuntimeProperties(DefaultFormBuilder builder)
+ {
+ builder.append("Build Id");
+ builder.append(_buildId, _refreshButton);
+ builder.nextLine();
+
+ builder.append("Properties");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+
+ builder.nextLine();
+ builder.append("");
+
+ builder.nextRow(-6);
+ CellConstraints cc = new CellConstraints();
+ JScrollPane scrollPane = new JScrollPane(_runtimeProperties);
+ builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
+ builder.nextRow(6);
+ builder.nextLine();
+ }
+
+ protected Communicator _target;
+
+ private JTextField _buildId = new JTextField(20);
+ private JButton _refreshButton;
+ private TableField _runtimeProperties = new TableField("Name", "Value");
+ private boolean _runtimePropertiesRetrieved = false;
+
private JTextArea _description = new JTextArea(3, 20);
- private TableField _properties = new TableField("Name", "Value");
+ private TableField _descriptorProperties = new TableField("Name", "Value");
}
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListArrayTreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListArrayTreeNode.java
deleted file mode 100644
index b07a14f30f1..00000000000
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListArrayTreeNode.java
+++ /dev/null
@@ -1,146 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package com.zeroc.IceGridGUI.LiveDeployment;
-
-import java.util.Enumeration;
-
-//
-// A TreeNode that holds an array of list of children
-//
-abstract class ListArrayTreeNode extends TreeNode
-{
- @Override
- public Enumeration<Object> children()
- {
- return new Enumeration<Object>()
- {
- @Override
- public boolean hasMoreElements()
- {
- if(_p.hasNext())
- {
- return true;
- }
-
- while(++_index < _childrenArray.length)
- {
- _p = _childrenArray[_index].iterator();
- if(_p.hasNext())
- {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public Object nextElement()
- {
- try
- {
- return _p.next();
- }
- catch(java.util.NoSuchElementException nse)
- {
- if(hasMoreElements())
- {
- return _p.next();
- }
- else
- {
- throw nse;
- }
- }
- }
-
- private int _index = 0;
- private java.util.Iterator _p = _childrenArray[0].iterator();
- };
- }
-
- @Override
- public boolean getAllowsChildren()
- {
- return true;
- }
-
- @Override
- public javax.swing.tree.TreeNode getChildAt(int childIndex)
- {
- if(childIndex < 0)
- {
- throw new ArrayIndexOutOfBoundsException(childIndex);
- }
- int offset = 0;
- for(java.util.List l : _childrenArray)
- {
- if(childIndex < offset + l.size())
- {
- return (javax.swing.tree.TreeNode)l.get(childIndex - offset);
- }
- else
- {
- offset += l.size();
- }
- }
- throw new ArrayIndexOutOfBoundsException(childIndex);
- }
-
- @Override
- public int getChildCount()
- {
- int result = 0;
- for(java.util.List l : _childrenArray)
- {
- result += l.size();
- }
- return result;
- }
-
- @Override
- public int getIndex(javax.swing.tree.TreeNode node)
- {
- int offset = 0;
- for(java.util.List l : _childrenArray)
- {
- int index = l.indexOf(node);
- if(index == -1)
- {
- offset += l.size();
- }
- else
- {
- return offset + index;
- }
- }
- return -1;
- }
-
- @Override
- public boolean isLeaf()
- {
- for(java.util.List l : _childrenArray)
- {
- if(!l.isEmpty())
- {
- return false;
- }
- }
- return true;
- }
-
- protected ListArrayTreeNode(TreeNode parent, String id, int arraySize)
- {
- super(parent, id);
- _childrenArray = new java.util.List[arraySize];
- }
-
- protected final java.util.List[] _childrenArray;
-}
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListTreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListTreeNode.java
deleted file mode 100644
index f22a715f32b..00000000000
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ListTreeNode.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// **********************************************************************
-//
-// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
-//
-// This copy of Ice is licensed to you under the terms described in the
-// ICE_LICENSE file included in this distribution.
-//
-// **********************************************************************
-
-package com.zeroc.IceGridGUI.LiveDeployment;
-
-import java.util.Enumeration;
-
-//
-// An TreeNode that holds a list of children
-//
-abstract class ListTreeNode extends TreeNode
-{
- @Override
- public Enumeration<Object> children()
- {
- return new Enumeration<Object>()
- {
- @Override
- public boolean hasMoreElements()
- {
- return _p.hasNext();
- }
-
- @Override
- public Object nextElement()
- {
- return _p.next();
- }
-
- private java.util.Iterator _p = _children.iterator();
- };
- }
-
- @Override
- public boolean getAllowsChildren()
- {
- return true;
- }
-
- @Override
- public javax.swing.tree.TreeNode getChildAt(int childIndex)
- {
- if(childIndex < 0)
- {
- throw new ArrayIndexOutOfBoundsException(childIndex);
- }
- else if(childIndex < _children.size())
- {
- return _children.get(childIndex);
- }
- else
- {
- throw new ArrayIndexOutOfBoundsException(childIndex);
- }
- }
-
- @Override
- public int getChildCount()
- {
- return _children.size();
- }
-
- @Override
- public int getIndex(javax.swing.tree.TreeNode node)
- {
- return _children.indexOf(node);
- }
-
- @Override
- public boolean isLeaf()
- {
- return _children.isEmpty();
- }
-
- protected ListTreeNode(TreeNode parent, String id)
- {
- super(parent, id);
- }
-
- protected final java.util.List<javax.swing.tree.TreeNode> _children =
- new java.util.LinkedList<javax.swing.tree.TreeNode>();
-}
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java
index e546b8f920b..d5949c9c8eb 100755
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Node.java
@@ -23,7 +23,7 @@ import java.text.NumberFormat;
import com.zeroc.IceGrid.*;
import com.zeroc.IceGridGUI.*;
-class Node extends ListTreeNode
+class Node extends Communicator
{
//
// Actions
@@ -42,63 +42,6 @@ class Node extends ListTreeNode
}
@Override
- public void retrieveIceLog()
- {
- if(_showIceLogDialog == null)
- {
- final String prefix = "Retrieving Admin proxy for Node " + _id + "...";
- final String errorTitle = "Failed to retrieve Admin Proxy for Node " + _id;
- getRoot().getCoordinator().getStatusBar().setText(prefix);
-
- try
- {
- getRoot().getCoordinator().getSession().getAdmin().getNodeAdminAsync(_id).whenComplete((result, ex) ->
- {
- if(ex == null)
- {
- final com.zeroc.Ice.LoggerAdminPrx loggerAdmin =
- com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(result.ice_facet("Logger"));
- final String title = "Node " + _id + " Ice log";
- final String defaultFileName = "node-" + _id;
-
- SwingUtilities.invokeLater(() ->
- {
- success(prefix);
- if(_showIceLogDialog == null)
- {
- _showIceLogDialog = new ShowIceLogDialog(Node.this, title, loggerAdmin,
- defaultFileName,
- getRoot().getLogMaxLines(),
- getRoot().getLogInitialLines());
- }
- else
- {
- _showIceLogDialog.toFront();
- }
- });
- }
- else if(ex instanceof com.zeroc.Ice.UserException)
- {
- amiFailure(prefix, errorTitle, (com.zeroc.Ice.UserException)ex);
- }
- else
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- });
- }
- catch(com.zeroc.Ice.LocalException e)
- {
- failure(prefix, errorTitle, e.toString());
- }
- }
- else
- {
- _showIceLogDialog.toFront();
- }
- }
-
- @Override
public void retrieveOutput(final boolean stdout)
{
getRoot().openShowLogFileDialog(new ShowLogFileDialog.FileIteratorFactory()
@@ -164,9 +107,8 @@ class Node extends ListTreeNode
@Override
public void startAllServers()
{
- for(Object obj : _children)
+ for(Server server : _servers)
{
- Server server = (Server)obj;
if(server.getAvailableActions()[START])
{
server.start();
@@ -177,9 +119,8 @@ class Node extends ListTreeNode
@Override
public void stopAllServers()
{
- for(Object obj : _children)
+ for(Server server : _servers)
{
- Server server = (Server)obj;
if(server.getAvailableActions()[STOP])
{
server.stop();
@@ -268,28 +209,56 @@ class Node extends ListTreeNode
return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
+
+ //
+ // Implement Communicator abstract methods
+ //
+
+ @Override
+ protected java.util.concurrent.CompletableFuture<com.zeroc.Ice.ObjectPrx> getAdminAsync()
+ {
+ return getRoot().getCoordinator().getSession().getAdmin().getNodeAdminAsync(_id);
+ }
+
+ @Override
+ protected String getServerDisplayName()
+ {
+ return "Node " + _id;
+ }
+
@Override
- public void clearShowIceLogDialog()
+ protected String getDisplayName()
{
- _showIceLogDialog = null;
+ return "Node " + _id;
}
+ @Override
+ protected String getDefaultFileName()
+ {
+ return "node-" + _id;
+ }
Node(Root parent, NodeDynamicInfo info)
{
- super(parent, info.info.name);
+ super(parent, info.info.name, 2);
+ _childrenArray[0] = _metrics;
+ _childrenArray[1] = _servers;
up(info, false);
}
Node(Root parent, ApplicationDescriptor appDesc, String nodeName, NodeDescriptor nodeDesc)
{
- super(parent, nodeName);
+ super(parent, nodeName, 2);
+ _childrenArray[0] = _metrics;
+ _childrenArray[1] = _servers;
add(appDesc, nodeDesc);
}
Node(Root parent, ApplicationDescriptor appDesc, NodeUpdateDescriptor update)
{
- super(parent, update.name);
+ super(parent, update.name, 2);
+ _childrenArray[0] = _metrics;
+ _childrenArray[1] = _servers;
NodeDescriptor nodeDesc = new NodeDescriptor(
update.variables,
@@ -372,12 +341,12 @@ class Node extends ListTreeNode
}
java.util.List<Server> toRemove = new java.util.LinkedList<>();
- int[] toRemoveIndices = new int[_children.size()];
+ int[] toRemoveIndices = new int[_servers.size()];
int i = 0;
- for(int index = 0; index < _children.size(); ++index)
+ for(int index = 0; index < _servers.size(); ++index)
{
- Server server = (Server)_children.get(index);
+ Server server = _servers.get(index);
if(server.getApplication().name.equals(appName))
{
toRemove.add(server);
@@ -385,7 +354,7 @@ class Node extends ListTreeNode
}
}
toRemoveIndices = resize(toRemoveIndices, toRemove.size());
- _children.removeAll(toRemove);
+ _servers.removeAll(toRemove);
getRoot().getTreeModel().nodesWereRemoved(this, toRemoveIndices, toRemove.toArray());
return false;
@@ -467,7 +436,7 @@ class Node extends ListTreeNode
server.removeCallbacks();
removeDescriptor(nodeDesc, server);
int index = getIndex(server);
- _children.remove(server);
+ _servers.remove(server);
getRoot().getTreeModel().nodesWereRemoved(this, new int[]{index}, new Object[]{server});
}
}
@@ -489,7 +458,8 @@ class Node extends ListTreeNode
else
{
removeDescriptor(nodeDesc, oldServer);
- oldServer.rebuild(server, true);
+ oldServer.rebuild(server);
+ oldServer.updateMetrics();
freshServers.add(oldServer);
nodeDesc.serverInstances.add(desc);
}
@@ -509,7 +479,8 @@ class Node extends ListTreeNode
else
{
removeDescriptor(nodeDesc, oldServer);
- oldServer.rebuild(server, true);
+ oldServer.rebuild(server);
+ oldServer.updateMetrics();
freshServers.add(oldServer);
nodeDesc.servers.add(desc);
}
@@ -521,9 +492,8 @@ class Node extends ListTreeNode
//
// Rebuild every other server in this application
//
- for(javax.swing.tree.TreeNode p : _children)
+ for(Server server : _servers)
{
- Server server = (Server)p;
if(server.getApplication() == appDesc)
{
if(!freshServers.contains(server))
@@ -586,9 +556,8 @@ class Node extends ListTreeNode
{
String appName = data.resolver.find("application");
- for(javax.swing.tree.TreeNode p : _children)
+ for(Server server : _servers)
{
- Server server = (Server)p;
if(server.getApplication().name.equals(appName))
{
server.rebuild(data.resolver, true, null, null);
@@ -610,9 +579,8 @@ class Node extends ListTreeNode
updatedServers.add(server);
}
}
- for(javax.swing.tree.TreeNode p : _children)
+ for(Server server : _servers)
{
- Server server = (Server)p;
if(!updatedServers.contains(server))
{
server.update(ServerState.Inactive, 0, true, true);
@@ -622,11 +590,11 @@ class Node extends ListTreeNode
//
// Tell adapters
//
- java.util.Iterator<javax.swing.tree.TreeNode> p = _children.iterator();
+ java.util.Iterator<Server> p = _servers.iterator();
int updateCount = 0;
while(p.hasNext() && updateCount < _info.adapters.size())
{
- Server server = (Server)p.next();
+ Server server = p.next();
updateCount += server.updateAdapters(_info.adapters);
}
@@ -647,15 +615,14 @@ class Node extends ListTreeNode
_showIceLogDialog.stopped();
}
- if(_children.isEmpty())
+ if(_servers.isEmpty())
{
return true;
}
else
{
- for(javax.swing.tree.TreeNode p : _children)
+ for(Server server : _servers)
{
- Server server = (Server)p;
server.nodeDown();
}
@@ -724,9 +691,8 @@ class Node extends ListTreeNode
}
}
- for(javax.swing.tree.TreeNode p : _children)
+ for(Server server : _servers)
{
- Server server = (Server)p;
if(server.updateAdapter(updatedInfo))
{
break;
@@ -772,16 +738,18 @@ class Node extends ListTreeNode
void showLoad()
{
- try
+ com.zeroc.IceGrid.AdminPrx admin = getCoordinator().getAdmin();
+ if(admin == null)
{
- getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ _editor.setLoad("Unknown", this);
+ }
+ else
+ {
+ _editor.setLoad("", this);
+ final String prefix = "Retrieving load for " + getDisplayName() + "...";
+ getRoot().getCoordinator().getStatusBar().setText(prefix);
- com.zeroc.IceGrid.AdminPrx admin = getCoordinator().getAdmin();
- if(admin == null)
- {
- _editor.setLoad("Unknown", this);
- }
- else
+ try
{
admin.getNodeLoadAsync(_id).whenComplete((result, ex) ->
{
@@ -806,38 +774,22 @@ class Node extends ListTreeNode
format.format(result.avg5) + " " +
format.format(result.avg15);
- SwingUtilities.invokeLater(() -> _editor.setLoad(load, Node.this));
- }
- else
- {
SwingUtilities.invokeLater(() ->
{
- if(ex instanceof com.zeroc.IceGrid.NodeNotExistException)
- {
- _editor.setLoad(
- "Error: this node is not known to this IceGrid Registry",
- Node.this);
- }
- else if(ex instanceof com.zeroc.IceGrid.NodeUnreachableException)
- {
- _editor.setLoad("Error: cannot reach this node", Node.this);
- }
- else
- {
- _editor.setLoad("Error: " + ex.toString(), Node.this);
- }
+ success(prefix);
+ _editor.setLoad(load, Node.this);
});
}
+ else
+ {
+ amiFailure(prefix, "Failed to retrieve load for " + getDisplayName(), ex);
+ }
});
}
- }
- catch(com.zeroc.Ice.LocalException e)
- {
- _editor.setLoad("Error: " + e.toString(), this);
- }
- finally
- {
- getCoordinator().getMainFrame().setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ catch(com.zeroc.Ice.LocalException e)
+ {
+ getRoot().getCoordinator().getStatusBar().setText(prefix + " " + e.toString() + ".");
+ }
}
}
@@ -931,12 +883,12 @@ class Node extends ListTreeNode
private void insertServer(Server server)
{
- insertSortedChild(server, _children, getRoot().getTreeModel());
+ insertSortedChild(server, _servers, getRoot().getTreeModel());
}
private Server findServer(String id)
{
- return (Server)find(id, _children);
+ return (Server)find(id, _servers);
}
private void removeDescriptor(NodeDescriptor nodeDesc, Server server)
@@ -992,12 +944,7 @@ class Node extends ListTreeNode
public java.util.List<Server> getServers()
{
- java.util.List<Server> servers = new java.util.ArrayList<>();
- for(Object obj : _children)
- {
- servers.add((Server)obj);
- }
- return servers;
+ return new java.util.ArrayList<Server>(_servers);
}
//
@@ -1009,7 +956,7 @@ class Node extends ListTreeNode
private NodeDynamicInfo _info;
private boolean _windows = false;
- private ShowIceLogDialog _showIceLogDialog;
+ private java.util.LinkedList<Server> _servers = new java.util.LinkedList<>();
static private DefaultTreeCellRenderer _cellRenderer;
static private Icon _nodeUp;
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java
index d1bee1e968d..f71094dd1c8 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/NodeEditor.java
@@ -23,7 +23,7 @@ import com.jgoodies.forms.layout.CellConstraints;
import com.zeroc.IceGrid.*;
-class NodeEditor extends Editor
+class NodeEditor extends CommunicatorEditor
{
NodeEditor()
{
@@ -32,21 +32,24 @@ class NodeEditor extends Editor
_machineType.setEditable(false);
_loadAverage.setEditable(false);
- Action refresh = new AbstractAction("Refresh")
+ Action refreshLoad = new AbstractAction("Refresh")
{
@Override
public void actionPerformed(ActionEvent e)
{
- _target.showLoad();
+ _loadAverage.setText("");
+ _loadRetrieved = false;
+ ((Node)_target).showLoad();
}
};
- refresh.putValue(Action.SHORT_DESCRIPTION,
+ refreshLoad.putValue(Action.SHORT_DESCRIPTION,
"Fetch the latest values from this IceGrid Node");
- _refreshButton = new JButton(refresh);
+ _refreshLoadButton = new JButton(refreshLoad);
}
void show(Node node)
{
+ Node previous = (Node)_target;
_target = node;
NodeInfo info = node.getStaticInfo();
@@ -58,6 +61,9 @@ class NodeEditor extends Editor
_machineType.setText("Unknown");
_loadAverageLabel.setText("Load Average");
_loadAverage.setText("Unknown");
+ _loadRetrieved = false;
+ _refreshLoadButton.setEnabled(false);
+ clearRuntimeProperties("Unknown");
}
else
{
@@ -79,8 +85,16 @@ class NodeEditor extends Editor
_loadAverageLabel.setText("Load Average");
_loadAverage.setToolTipText("Load average in the past 1 min, 5 min and 15 min period");
}
- _loadAverage.setText("Refreshing...");
- node.showLoad();
+
+ if(_target != previous || !_loadRetrieved)
+ {
+ _loadAverage.setText("Refreshing load...");
+ _loadRetrieved = true;
+ node.showLoad();
+ _refreshLoadButton.setEnabled(true);
+ }
+
+ showRuntimeProperties(previous);
}
_loadFactor.setSortedMap(node.getLoadFactors());
@@ -91,6 +105,7 @@ class NodeEditor extends Editor
if(node == _target)
{
_loadAverage.setText(load);
+ _loadRetrieved = true;
}
//
// Otherwise, we've already moved to another node
@@ -112,11 +127,11 @@ class NodeEditor extends Editor
builder.append("Machine Type");
builder.append(_machineType, 3);
builder.append(_loadAverageLabel, _loadAverage);
- builder.append(_refreshButton);
+ builder.append(_refreshLoadButton);
builder.nextLine();
+ appendRuntimeProperties(builder);
builder.appendSeparator("Configuration");
-
builder.append("Load Factor");
builder.nextLine();
@@ -147,9 +162,8 @@ class NodeEditor extends Editor
private JTextField _machineType = new JTextField(20);
private JLabel _loadAverageLabel = new JLabel();
private JTextField _loadAverage = new JTextField(20);
- private JButton _refreshButton;
+ private JButton _refreshLoadButton;
+ private boolean _loadRetrieved = false;
private TableField _loadFactor = new TableField("Application", "Value");
-
- private Node _target;
}
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java
index 5513f430400..e83bfde9b64 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/RegistryEditor.java
@@ -27,7 +27,7 @@ import com.jgoodies.forms.layout.CellConstraints;
import com.zeroc.IceGrid.*;
import com.zeroc.IceGridGUI.*;
-class RegistryEditor extends Editor
+class RegistryEditor extends CommunicatorEditor
{
RegistryEditor()
{
@@ -42,7 +42,7 @@ class RegistryEditor extends Editor
if(selectedRow != -1)
{
String appName = (String)_applications.getValueAt(selectedRow, 0);
- ApplicationPane app = _target.getCoordinator().openLiveApplication(appName);
+ ApplicationPane app = ((Root)_target).getCoordinator().openLiveApplication(appName);
if(app != null && app.getRoot().getSelectedNode() == null)
{
@@ -61,7 +61,7 @@ class RegistryEditor extends Editor
if(selectedRow != -1)
{
String appName = (String)_applications.getValueAt(selectedRow, 0);
- _target.showApplicationDetails(appName);
+ ((Root)_target).showApplicationDetails(appName);
}
}
};
@@ -75,7 +75,7 @@ class RegistryEditor extends Editor
if(selectedRow != -1)
{
String appName = (String)_applications.getValueAt(selectedRow, 0);
- _target.patch(appName);
+ ((Root)_target).patch(appName);
}
}
};
@@ -91,7 +91,7 @@ class RegistryEditor extends Editor
String appName = (String)_applications.getValueAt(selectedRow, 0);
int confirm = JOptionPane.showConfirmDialog(
- _target.getCoordinator().getMainFrame(),
+ ((Root)_target).getCoordinator().getMainFrame(),
"You are about to remove application '" + appName + "' from the IceGrid registry. "
+ "Do you want to proceed?",
"Remove Confirmation",
@@ -99,7 +99,7 @@ class RegistryEditor extends Editor
if(confirm == JOptionPane.YES_OPTION)
{
- _target.getCoordinator().removeApplicationFromRegistry(appName);
+ ((Root)_target).getCoordinator().removeApplicationFromRegistry(appName);
}
}
}
@@ -129,7 +129,7 @@ class RegistryEditor extends Editor
if(selectedRow != -1)
{
String appName = (String)_applications.getValueAt(selectedRow, 0);
- _target.showApplicationDetails(appName);
+ ((Root)_target).showApplicationDetails(appName);
}
}
}
@@ -152,7 +152,7 @@ class RegistryEditor extends Editor
if (e.isPopupTrigger() && selectedRow != -1)
{
String appName = (String)_applications.getValueAt(selectedRow, 0);
- ApplicationDescriptor desc = _target.getApplicationDescriptor(appName);
+ ApplicationDescriptor desc = ((Root)_target).getApplicationDescriptor(appName);
patch.setEnabled(desc != null && desc.distrib.icepatch.length() > 0);
appPopup.show(_applications, e.getX(), e.getY());
}
@@ -165,12 +165,12 @@ class RegistryEditor extends Editor
@Override
public void actionPerformed(ActionEvent e)
{
- if(_target.getCoordinator().connectedToMaster())
+ if(((Root)_target).getCoordinator().connectedToMaster())
{
int selectedRow = _objects.getSelectedRow();
if(selectedRow != -1)
{
- _target.removeObject((String)_objects.getValueAt(selectedRow, 0));
+ ((Root)_target).removeObject((String)_objects.getValueAt(selectedRow, 0));
}
}
}
@@ -190,7 +190,7 @@ class RegistryEditor extends Editor
{
String proxy = (String)_objects.getValueAt(selectedRow, 0);
String type = (String)_objects.getValueAt(selectedRow, 1);
- _target.showObject(proxy, type);
+ ((Root)_target).showObject(proxy, type);
}
}
};
@@ -200,9 +200,9 @@ class RegistryEditor extends Editor
@Override
public void actionPerformed(ActionEvent e)
{
- if(_target.getCoordinator().connectedToMaster())
+ if(((Root)_target).getCoordinator().connectedToMaster())
{
- _target.addObject();
+ ((Root)_target).addObject();
}
}
};
@@ -234,7 +234,7 @@ class RegistryEditor extends Editor
{
String proxy = (String)_objects.getValueAt(selectedRow, 0);
String type = (String)_objects.getValueAt(selectedRow, 1);
- _target.showObject(proxy, type);
+ ((Root)_target).showObject(proxy, type);
}
}
}
@@ -267,12 +267,12 @@ class RegistryEditor extends Editor
@Override
public void actionPerformed(ActionEvent e)
{
- if(_target.getCoordinator().connectedToMaster())
+ if(((Root)_target).getCoordinator().connectedToMaster())
{
int selectedRow = _adapters.getSelectedRow();
if(selectedRow != -1)
{
- _target.removeAdapter((String)_adapters.getValueAt(selectedRow, 0));
+ ((Root)_target).removeAdapter((String)_adapters.getValueAt(selectedRow, 0));
}
}
}
@@ -318,6 +318,7 @@ class RegistryEditor extends Editor
builder.append("Hostname" );
builder.append(_hostname, 3);
builder.nextLine();
+ appendRuntimeProperties(builder);
builder.appendSeparator("Deployed Applications");
builder.append("");
@@ -398,8 +399,10 @@ class RegistryEditor extends Editor
void show(Root root)
{
+ Root previous = (Root)_target;
_target = root;
_hostname.setText(root.getRegistryInfo().hostname);
+ showRuntimeProperties(previous);
_applications.setSortedMap(root.getApplicationMap());
_objects.setObjects(root.getObjects());
_adapters.setAdapters(root.getAdapters());
@@ -409,6 +412,4 @@ class RegistryEditor extends Editor
private TableField _applications = new TableField("Name", "Last Update");
private TableField _objects = new TableField("Proxy", "Type");
private TableField _adapters = new TableField("ID", "Endpoints", "Replica Group");
-
- private Root _target;
}
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java
index c0f646fa74f..368534e7194 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Root.java
@@ -29,7 +29,7 @@ import com.zeroc.IceGridGUI.*;
//
// The Root node of the Live Deployment view
//
-public class Root extends ListArrayTreeNode
+public class Root extends Communicator
{
//
// A custom tree model to filter tree views.
@@ -150,18 +150,13 @@ public class Root extends ListArrayTreeNode
return _applicationNameFilter;
}
- @Override
- public void clearShowIceLogDialog()
- {
- _showIceLogDialog = null;
- }
-
public Root(Coordinator coordinator)
{
- super(null, "Root", 2);
+ super(null, "Root", 3);
_coordinator = coordinator;
- _childrenArray[0] = _slaves;
- _childrenArray[1] = _nodes;
+ _childrenArray[0] = _metrics;
+ _childrenArray[1] = _slaves;
+ _childrenArray[2] = _nodes;
_messageSizeMax = computeMessageSizeMax(_coordinator.getProperties().getPropertyAsInt("Ice.MessageSizeMax"));
_treeModel = new FilteredTreeModel(this);
@@ -176,16 +171,12 @@ public class Root extends ListArrayTreeNode
public void treeWillExpand(javax.swing.event.TreeExpansionEvent event)
{
//
- // Fetch metrics when Server node is expanded.
+ // Fetch metrics when Communicator node is expanded.
//
TreeNode node = (TreeNode)event.getPath().getLastPathComponent();
- if(node instanceof Server)
+ if(node instanceof Communicator)
{
- ((Server)node).fetchMetricsViewNames();
- }
- else if(node instanceof Service)
- {
- ((Service)node).fetchMetricsViewNames();
+ ((Communicator)node).fetchMetricsViewNames();
}
}
@@ -627,6 +618,7 @@ public class Root extends ListArrayTreeNode
if(info.name.equals(_replicaName))
{
_info = info;
+ fetchMetricsViewNames();
}
else
{
@@ -926,60 +918,26 @@ public class Root extends ListArrayTreeNode
}
}
+ //
+ // Implement Communicator abstract methods
+ //
+
@Override
- public void retrieveIceLog()
+ protected java.util.concurrent.CompletableFuture<com.zeroc.Ice.ObjectPrx> getAdminAsync()
{
- if(_showIceLogDialog == null)
- {
- final String prefix = "Retrieving Admin proxy for Registry...";
- final String errorTitle = "Failed to retrieve Admin Proxy for Registry";
- _coordinator.getStatusBar().setText(prefix);
+ return _coordinator.getSession().getAdmin().getRegistryAdminAsync(_replicaName);
+ }
- try
- {
- _coordinator.getSession().getAdmin().getRegistryAdminAsync(_replicaName).whenComplete((result, ex) ->
- {
- if(ex == null)
- {
- final com.zeroc.Ice.LoggerAdminPrx loggerAdmin =
- com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(result.ice_facet("Logger"));
- final String title = "Registry " + _label + " Ice log";
- final String defaultFileName = "registry-" + _instanceName + "-" + _replicaName;
-
- SwingUtilities.invokeLater(() ->
- {
- success(prefix);
- if(_showIceLogDialog == null)
- {
- _showIceLogDialog = new ShowIceLogDialog(Root.this, title, loggerAdmin,
- defaultFileName, getLogMaxLines(),
- getLogInitialLines());
- }
- else
- {
- _showIceLogDialog.toFront();
- }
- });
- }
- else if(ex instanceof com.zeroc.Ice.UserException)
- {
- amiFailure(prefix, errorTitle, (com.zeroc.Ice.UserException)ex);
- }
- else
- {
- amiFailure(prefix, errorTitle, ex.toString());
- }
- });
- }
- catch(com.zeroc.Ice.LocalException e)
- {
- failure(prefix, errorTitle, e.toString());
- }
- }
- else
- {
- _showIceLogDialog.toFront();
- }
+ @Override
+ protected String getDisplayName()
+ {
+ return "Registry";
+ }
+
+ @Override
+ protected String getDefaultFileName()
+ {
+ return "registry-" + _instanceName + "-" + _replicaName;
}
@Override
@@ -1228,8 +1186,6 @@ public class Root extends ListArrayTreeNode
int _logMaxReadSize;
int _logPeriod;
- private ShowIceLogDialog _showIceLogDialog;
-
private ApplicationDetailsDialog _applicationDetailsDialog;
static private RegistryEditor _editor;
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java
index af9e19a9867..597926d0dfb 100755
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Server.java
@@ -23,7 +23,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import com.zeroc.IceGrid.*;
import com.zeroc.IceGridGUI.*;
-public class Server extends ListArrayTreeNode
+public class Server extends Communicator
{
//
// Actions
@@ -102,7 +102,7 @@ public class Server extends ListArrayTreeNode
if(ex == null)
{
amiSuccess(prefix);
- SwingUtilities.invokeLater(() -> rebuild(Server.this, false));
+ SwingUtilities.invokeLater(() -> rebuild(Server.this));
}
else if(ex instanceof com.zeroc.Ice.UserException)
{
@@ -143,31 +143,6 @@ public class Server extends ListArrayTreeNode
}
@Override
- public void retrieveIceLog()
- {
- if(_showIceLogDialog == null)
- {
- com.zeroc.Ice.ObjectPrx serverAdmin = getServerAdmin();
- if(serverAdmin == null)
- {
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Admin not available",
- "No Admin for server " + _id, JOptionPane.ERROR_MESSAGE);
- return;
- }
-
- com.zeroc.Ice.LoggerAdminPrx loggerAdmin =
- com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(serverAdmin.ice_facet("Logger"));
- String title = "Server " + _id + " Ice log";
- _showIceLogDialog = new ShowIceLogDialog(this, title, loggerAdmin, _id, getRoot().getLogMaxLines(),
- getRoot().getLogInitialLines());
- }
- else
- {
- _showIceLogDialog.toFront();
- }
- }
-
- @Override
public void retrieveOutput(final boolean stdout)
{
getRoot().openShowLogFileDialog(new ShowLogFileDialog.FileIteratorFactory()
@@ -340,128 +315,6 @@ public class Server extends ListArrayTreeNode
}
}
- public void fetchMetricsViewNames()
- {
- if(_metricsRetrieved)
- {
- return; // Already loaded.
- }
-
- com.zeroc.Ice.ObjectPrx admin = getServerAdmin();
- if(admin == null)
- {
- return;
- }
- _metricsRetrieved = true;
- final com.zeroc.IceMX.MetricsAdminPrx metricsAdmin =
- com.zeroc.IceMX.MetricsAdminPrx.uncheckedCast(admin.ice_facet("Metrics"));
- try
- {
- metricsAdmin.getMetricsViewNamesAsync().whenComplete((result, ex) ->
- {
- if(ex == null)
- {
- SwingUtilities.invokeLater(() ->
- {
- for(String name : result.returnValue)
- {
- insertSortedChild(
- new MetricsView(Server.this, name, metricsAdmin, true), _metrics, null);
- }
- for(String name : result.disabledViews)
- {
- insertSortedChild(
- new MetricsView(Server.this, name, metricsAdmin, false), _metrics, null);
- }
- rebuild(Server.this, false);
- });
- }
- else
- {
- SwingUtilities.invokeLater(() ->
- {
- _metricsRetrieved = false;
- if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
- {
- // Server is down.
- }
- else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
- {
- // MetricsAdmin facet not present. Old server version?
- }
- else
- {
- ex.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + ex.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- });
- }
- });
- }
- catch(com.zeroc.Ice.LocalException e)
- {
- _metricsRetrieved = false;
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
-
- void showRuntimeProperties()
- {
- com.zeroc.Ice.ObjectPrx serverAdmin = getServerAdmin();
-
- if(serverAdmin == null)
- {
- _editor.setBuildId("", this);
- }
- else
- {
- try
- {
- com.zeroc.Ice.PropertiesAdminPrx propAdmin =
- com.zeroc.Ice.PropertiesAdminPrx.uncheckedCast(serverAdmin.ice_facet("Properties"));
- propAdmin.getPropertiesForPrefixAsync("").whenComplete((result, ex) ->
- {
- if(ex == null)
- {
- SwingUtilities.invokeLater(() ->
- {
- _editor.setRuntimeProperties((java.util.SortedMap<String, String>)result,
- Server.this);
- });
- }
- else
- {
- SwingUtilities.invokeLater(() ->
- {
- if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
- {
- _editor.setBuildId("Error: can't reach this server's Admin object",
- Server.this);
- }
- else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
- {
- _editor.setBuildId("Error: this server's Admin object does not provide a " +
- "'Properties' facet", Server.this);
- }
- else
- {
- ex.printStackTrace();
- _editor.setBuildId("Error: " + ex.toString(), Server.this);
- }
- });
- }
- });
- }
- catch(com.zeroc.Ice.LocalException e)
- {
- _editor.setBuildId("Error: " + e.toString(), this);
- }
- }
- }
-
@Override
public void openDefinition()
{
@@ -630,12 +483,6 @@ public class Server extends ListArrayTreeNode
return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
- @Override
- public void clearShowIceLogDialog()
- {
- _showIceLogDialog = null;
- }
-
Server(Node parent, String serverId, Utils.Resolver resolver, ServerInstanceDescriptor instanceDescriptor,
ServerDescriptor serverDescriptor, ApplicationDescriptor application, ServerState state, int pid,
boolean enabled)
@@ -723,16 +570,7 @@ public class Server extends ListArrayTreeNode
}
}
- void updateMetrics()
- {
- _metricsRetrieved = false;
- if(getRoot().getTree().isExpanded(getPath()))
- {
- fetchMetricsViewNames();
- }
- }
-
- void rebuild(Server server, boolean fetchMetrics)
+ void rebuild(Server server)
{
_resolver = server._resolver;
_instanceDescriptor = server._instanceDescriptor;
@@ -775,11 +613,6 @@ public class Server extends ListArrayTreeNode
updateServices();
getRoot().getTreeModel().nodeStructureChanged(this);
-
- if(fetchMetrics)
- {
- updateMetrics();
- }
}
void rebuild(Utils.Resolver resolver, boolean variablesChanged, java.util.Set<String> serviceTemplates,
@@ -860,7 +693,7 @@ public class Server extends ListArrayTreeNode
if(!_metrics.isEmpty())
{
_metrics.clear();
- rebuild(this, false);
+ rebuild(this);
}
}
@@ -948,13 +781,11 @@ public class Server extends ListArrayTreeNode
// Note that duplicate registrations are ignored
//
- com.zeroc.Ice.ObjectPrx serverAdmin = getServerAdmin();
- if(serverAdmin != null)
- {
- com.zeroc.IceBox.ServiceManagerPrx serviceManager =
- com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast(
- serverAdmin.ice_facet("IceBox.ServiceManager"));
+ com.zeroc.IceBox.ServiceManagerPrx serviceManager =
+ com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast(getAdminFacet("IceBox.ServiceManager"));
+ if(serviceManager != null)
+ {
try
{
serviceManager.addObserverAsync(_serviceObserver).whenComplete((result, ex) ->
@@ -1170,21 +1001,52 @@ public class Server extends ListArrayTreeNode
serverInstancePSDescriptor));
}
- com.zeroc.Ice.ObjectPrx getServerAdmin()
+
+ //
+ // Implement Communicator abstract methods
+ //
+
+ @Override
+ protected java.util.concurrent.CompletableFuture<com.zeroc.Ice.ObjectPrx> getAdminAsync()
+ {
+ return java.util.concurrent.CompletableFuture.completedFuture(getAdmin());
+ }
+
+ @Override
+ protected String getDisplayName()
{
- if(_state != ServerState.Active)
+ return "Server " + _id;
+ }
+
+ @Override
+ protected String getDefaultFileName()
+ {
+ return _id;
+ }
+
+ com.zeroc.Ice.ObjectPrx getAdmin()
+ {
+ if(_state == ServerState.Active)
{
- return null;
+ AdminPrx gridAdmin = getCoordinator().getAdmin();
+ if(gridAdmin != null)
+ {
+ return gridAdmin.ice_identity(new com.zeroc.Ice.Identity(_id, getCoordinator().getServerAdminCategory()));
+ }
}
- AdminPrx admin = getCoordinator().getAdmin();
- if(admin == null)
+ return null;
+ }
+
+ com.zeroc.Ice.ObjectPrx getAdminFacet(String facet)
+ {
+ com.zeroc.Ice.ObjectPrx admin = getAdmin();
+ if(admin != null)
{
- return null;
+ return admin.ice_facet(facet);
}
else
{
- com.zeroc.Ice.Identity adminId = new com.zeroc.Ice.Identity(_id, getCoordinator().getServerAdminCategory());
- return admin.ice_identity(adminId);
+ return null;
}
}
@@ -1204,12 +1066,6 @@ public class Server extends ListArrayTreeNode
return result;
}
- public java.util.List<MetricsView>
- getMetrics()
- {
- return new java.util.ArrayList<>(_metrics);
- }
-
private ServerInstanceDescriptor _instanceDescriptor;
private java.util.Map<String, PropertySetDescriptor> _servicePropertySets =
new java.util.HashMap<>(); // with substituted names!
@@ -1221,7 +1077,6 @@ public class Server extends ListArrayTreeNode
private java.util.List<Adapter> _adapters = new java.util.LinkedList<>();
private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<>();
private java.util.List<Service> _services = new java.util.LinkedList<>();
- private java.util.List<MetricsView> _metrics = new java.util.LinkedList<>();
private java.util.Set<String> _startedServices = new java.util.HashSet<>();
@@ -1230,10 +1085,8 @@ public class Server extends ListArrayTreeNode
private int _stateIconIndex;
private int _pid;
private String _toolTip;
- private boolean _metricsRetrieved = false;
private com.zeroc.IceBox.ServiceObserverPrx _serviceObserver;
- private ShowIceLogDialog _showIceLogDialog;
static private DefaultTreeCellRenderer _cellRenderer;
static private Icon[][][] _icons;
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java
index 85f15377ab4..6ba4587fe3d 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServerEditor.java
@@ -49,8 +49,6 @@ class ServerEditor extends CommunicatorEditor
_currentState.setEditable(false);
_enabled.setEnabled(false);
_currentPid.setEditable(false);
- _buildId.setEditable(false);
-
_application.setEditable(false);
_exe.setEditable(false);
_iceVersion.setEditable(false);
@@ -68,25 +66,12 @@ class ServerEditor extends CommunicatorEditor
_icepatch.setEditable(false);
_directories.setEditable(false);
- Action refresh = new AbstractAction("Refresh")
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- _buildId.setText("Retrieving...");
- _properties.clear();
- _target.showRuntimeProperties();
- }
- };
- refresh.putValue(Action.SHORT_DESCRIPTION, "Reread the properties from the server");
- _refreshButton = new JButton(refresh);
-
Action gotoApplication = new AbstractAction("", Utils.getIcon("/icons/16x16/goto.png"))
{
@Override
public void actionPerformed(ActionEvent e)
{
- _target.openDefinition();
+ ((Server)_target).openDefinition();
}
};
gotoApplication.putValue(Action.SHORT_DESCRIPTION, "View/Edit this application");
@@ -95,8 +80,7 @@ class ServerEditor extends CommunicatorEditor
void show(Server server)
{
- Server previousServer = _target;
-
+ Server previousServer = (Server)_target;
_target = server;
ServerState state = server.getState();
@@ -108,10 +92,7 @@ class ServerEditor extends CommunicatorEditor
_currentState.setText("Unknown");
_enabled.setSelected(false);
_currentPid.setText("");
- _buildId.setText("Unknown");
- _properties.clear();
- _propertiesRetrieved = false;
- _refreshButton.setEnabled(false);
+ clearRuntimeProperties("Unknown");
}
else
{
@@ -131,29 +112,11 @@ class ServerEditor extends CommunicatorEditor
int iceIntVersion = server.getIceVersion();
if(state == ServerState.Active && (iceIntVersion == 0 || iceIntVersion >= 30300))
{
- if(!_propertiesRetrieved || previousServer != server)
- {
- _buildId.setText("Retrieving...");
- _properties.clear();
-
- //
- // Retrieve all properties in background
- //
- _target.showRuntimeProperties();
- _propertiesRetrieved = true; // set to true immediately to avoid 'spinning'
- }
-
- //
- // Otherwise, use current value
- //
- _refreshButton.setEnabled(true);
+ showRuntimeProperties(previousServer);
}
else
{
- _buildId.setText("");
- _properties.clear();
- _propertiesRetrieved = false;
- _refreshButton.setEnabled(false);
+ clearRuntimeProperties("");
}
}
@@ -204,43 +167,6 @@ class ServerEditor extends CommunicatorEditor
_directories.setToolTipText(toolTip);
}
- void setBuildId(String buildString, Server server)
- {
- //
- // That's to report error messages
- //
-
- if(server == _target)
- {
- _buildId.setText(buildString);
- }
- //
- // Otherwise we've already moved to another server
- //
- }
-
- void setRuntimeProperties(java.util.SortedMap<String, String> map, Server server)
- {
- if(server == _target)
- {
- _properties.setSortedMap(map);
- _propertiesRetrieved = true;
-
- String buildString = map.get("BuildId");
- if(buildString == null)
- {
- _buildId.setText("");
- }
- else
- {
- _buildId.setText(buildString);
- }
- }
- //
- // Otherwise we've already moved to another server
- //
- }
-
@Override
protected void appendProperties(DefaultFormBuilder builder)
{
@@ -256,38 +182,14 @@ class ServerEditor extends CommunicatorEditor
builder.append("Process Id");
builder.append(_currentPid, 3);
builder.nextLine();
-
- builder.append("Build Id");
- builder.append(_buildId, _refreshButton);
- builder.nextLine();
-
- builder.append("Properties");
- builder.nextLine();
- builder.append("");
- builder.nextLine();
- builder.append("");
-
- builder.nextLine();
- builder.append("");
-
- builder.nextRow(-6);
- CellConstraints cc = new CellConstraints();
- JScrollPane scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
- builder.nextRow(6);
- builder.nextLine();
+ appendRuntimeProperties(builder);
builder.appendSeparator("Configuration");
-
builder.append("Application");
builder.append(_application);
builder.append(_gotoApplication);
builder.nextLine();
-
- //
- // Add Communicator fields
- //
- super.appendProperties(builder);
+ appendDescriptorProperties(builder);
builder.appendSeparator("Activation");
builder.append("Path to Executable");
@@ -313,7 +215,8 @@ class ServerEditor extends CommunicatorEditor
builder.nextLine();
builder.append("");
builder.nextRow(-6);
- scrollPane = new JScrollPane(_envs);
+ CellConstraints cc = new CellConstraints();
+ JScrollPane scrollPane = new JScrollPane(_envs);
builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
builder.nextRow(6);
builder.nextLine();
@@ -370,15 +273,10 @@ class ServerEditor extends CommunicatorEditor
}
private Coordinator _coordinator;
- private Server _target;
private JTextField _currentState = new JTextField(20);
private JCheckBox _enabled = new JCheckBox("Enabled");
private JTextField _currentPid = new JTextField(20);
- private JTextField _buildId = new JTextField(20);
- private JButton _refreshButton;
- private TableField _properties = new TableField("Name", "Value");
- private boolean _propertiesRetrieved = false;
private JTextField _application = new JTextField(20);
private JButton _gotoApplication;
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java
index 64451a9a5be..1c657dad122 100755
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Service.java
@@ -21,7 +21,7 @@ import javax.swing.tree.DefaultTreeCellRenderer;
import com.zeroc.IceGrid.*;
import com.zeroc.IceGridGUI.*;
-public class Service extends ListArrayTreeNode
+public class Service extends Communicator
{
//
// Actions
@@ -58,16 +58,14 @@ public class Service extends ListArrayTreeNode
@Override
public void start()
{
- com.zeroc.Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin();
+ com.zeroc.IceBox.ServiceManagerPrx serviceManager = com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast(
+ ((Server)_parent).getAdminFacet("IceBox.ServiceManager"));
- if(serverAdmin != null)
+ if(serviceManager != null)
{
final String prefix = "Starting service '" + _id + "'...";
getCoordinator().getStatusBar().setText(prefix);
- com.zeroc.IceBox.ServiceManagerPrx serviceManager = com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast(
- serverAdmin.ice_facet("IceBox.ServiceManager"));
-
try
{
serviceManager.startServiceAsync(_id).whenComplete((result, ex) ->
@@ -92,16 +90,14 @@ public class Service extends ListArrayTreeNode
@Override
public void stop()
{
- com.zeroc.Ice.ObjectPrx serverAdmin = ((Server)_parent).getServerAdmin();
+ com.zeroc.IceBox.ServiceManagerPrx serviceManager = com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast(
+ ((Server)_parent).getAdminFacet("IceBox.ServiceManager"));
- if(serverAdmin != null)
+ if(serviceManager != null)
{
final String prefix = "Stopping service '" + _id + "'...";
getCoordinator().getStatusBar().setText(prefix);
- com.zeroc.IceBox.ServiceManagerPrx serviceManager = com.zeroc.IceBox.ServiceManagerPrx.uncheckedCast(
- serverAdmin.ice_facet("IceBox.ServiceManager"));
-
try
{
serviceManager.stopServiceAsync(_id).whenComplete((result, ex) ->
@@ -124,30 +120,6 @@ public class Service extends ListArrayTreeNode
}
@Override
- public void retrieveIceLog()
- {
- if(_showIceLogDialog == null)
- {
- com.zeroc.Ice.LoggerAdminPrx loggerAdmin =
- com.zeroc.Ice.LoggerAdminPrx.uncheckedCast(getAdminFacet("Logger"));
- if(loggerAdmin == null)
- {
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Admin not available",
- "No Admin for server " + _parent.getId(), JOptionPane.ERROR_MESSAGE);
- return;
- }
-
- String title = "Service " + _parent.getId() + "/" + _id + " Ice log";
- _showIceLogDialog = new ShowIceLogDialog(this, title, loggerAdmin, _parent.getId() + "-" + _id,
- getRoot().getLogMaxLines(), getRoot().getLogInitialLines());
- }
- else
- {
- _showIceLogDialog.toFront();
- }
- }
-
- @Override
public void retrieveLogFile()
{
assert _serviceDescriptor.logs.length > 0;
@@ -267,10 +239,51 @@ public class Service extends ListArrayTreeNode
return _popup;
}
+
+ //
+ // Implement Communicator abstract methods
+ //
+
@Override
- public void clearShowIceLogDialog()
+ protected java.util.concurrent.CompletableFuture<com.zeroc.Ice.ObjectPrx> getAdminAsync()
{
- _showIceLogDialog = null;
+ return java.util.concurrent.CompletableFuture.completedFuture(((Server)_parent).getAdmin());
+ }
+
+ @Override
+ protected String getServerDisplayName()
+ {
+ return "Server " + _parent.getId();
+ }
+
+ @Override
+ protected String getDisplayName()
+ {
+ return "Service " + _parent.getId() + "/" + _id;
+ }
+
+ @Override
+ protected String getDefaultFileName()
+ {
+ return _parent.getId() + "-" + _id;
+ }
+
+ com.zeroc.Ice.ObjectPrx getAdminFacet(String facet)
+ {
+ String facetName = "IceBox.Service." + _id + "." + facet;
+
+ try
+ {
+ if(Integer.valueOf(((Server)_parent).getProperties().get("IceBox.UseSharedCommunicator." + _id)) > 0)
+ {
+ facetName = "IceBox.SharedCommunicator." + facet;
+ }
+ }
+ catch(NumberFormatException ex)
+ {
+ }
+
+ return ((Server)_parent).getAdminFacet(facetName);
}
Service(Server parent, String serviceName, Utils.Resolver resolver, ServiceInstanceDescriptor descriptor,
@@ -367,56 +380,6 @@ public class Service extends ListArrayTreeNode
}
}
- void showRuntimeProperties()
- {
- com.zeroc.Ice.PropertiesAdminPrx propAdmin =
- com.zeroc.Ice.PropertiesAdminPrx.uncheckedCast(getAdminFacet("Properties"));
- if(propAdmin == null)
- {
- _editor.setBuildId("", this);
- }
- else
- {
- try
- {
- propAdmin.getPropertiesForPrefixAsync("").whenComplete((result, ex) ->
- {
- if(ex == null)
- {
- SwingUtilities.invokeLater(() ->
- {
- _editor.setRuntimeProperties((java.util.SortedMap<String, String>)result,
- Service.this);
- });
- }
- else
- {
- SwingUtilities.invokeLater(() ->
- {
- if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
- {
- _editor.setBuildId("Error: can't reach the icebox Admin object", Service.this);
- }
- else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
- {
- _editor.setBuildId("Error: this icebox Admin object does not provide a " +
- "'Properties' facet for this service", Service.this);
- }
- else
- {
- _editor.setBuildId("Error: " + ex.toString(), Service.this);
- }
- });
- }
- });
- }
- catch(com.zeroc.Ice.LocalException e)
- {
- _editor.setBuildId("Error: " + e.toString(), this);
- }
- }
- }
-
Utils.Resolver getResolver()
{
return _resolver;
@@ -481,71 +444,6 @@ public class Service extends ListArrayTreeNode
}
}
- public void fetchMetricsViewNames()
- {
- if(_metricsRetrieved)
- {
- return; // Already loaded.
- }
-
- final com.zeroc.IceMX.MetricsAdminPrx metricsAdmin =
- com.zeroc.IceMX.MetricsAdminPrx.uncheckedCast(getAdminFacet("Metrics"));
- if(metricsAdmin == null)
- {
- return;
- }
- _metricsRetrieved = true;
-
- try
- {
- metricsAdmin.getMetricsViewNamesAsync().whenComplete((result, ex) ->
- {
- if(ex == null)
- {
- SwingUtilities.invokeLater(() ->
- {
- for(String name : result.returnValue)
- {
- insertSortedChild(
- new MetricsView(Service.this, name, metricsAdmin, true), _metrics, null);
- }
- for(String name : result.disabledViews)
- {
- insertSortedChild(
- new MetricsView(Service.this, name, metricsAdmin, false), _metrics, null);
- }
- rebuild(Service.this);
- });
- }
- else
- {
- _metricsRetrieved = false;
- if(ex instanceof com.zeroc.Ice.ObjectNotExistException)
- {
- // Server is down.
- }
- else if(ex instanceof com.zeroc.Ice.FacetNotExistException)
- {
- // MetricsAdmin facet not present. Old server version?
- }
- else
- {
- ex.printStackTrace();
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(),
- "Error: " + ex.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
- });
- }
- catch(com.zeroc.Ice.LocalException e)
- {
- _metricsRetrieved = false;
- JOptionPane.showMessageDialog(getCoordinator().getMainFrame(), "Error: " + e.toString(), "Error",
- JOptionPane.ERROR_MESSAGE);
- }
- }
-
void rebuild(Service service)
{
_adapters = service._adapters;
@@ -576,27 +474,6 @@ public class Service extends ListArrayTreeNode
getRoot().getTreeModel().nodeStructureChanged(this);
}
- private com.zeroc.Ice.ObjectPrx getAdminFacet(String facet)
- {
- Server parent = (Server)_parent;
- com.zeroc.Ice.ObjectPrx serverAdmin = parent.getServerAdmin();
- if(serverAdmin == null)
- {
- return null;
- }
- try
- {
- if(Integer.valueOf(parent.getProperties().get("IceBox.UseSharedCommunicator." + _id)) > 0)
- {
- return serverAdmin.ice_facet("IceBox.SharedCommunicator." + facet);
- }
- }
- catch(NumberFormatException ex)
- {
- }
- return serverAdmin.ice_facet("IceBox.Service." + _id + "." + facet);
- }
-
private final ServiceInstanceDescriptor _instanceDescriptor;
private final ServiceDescriptor _serviceDescriptor;
private final PropertySetDescriptor _serverInstancePSDescriptor;
@@ -604,12 +481,8 @@ public class Service extends ListArrayTreeNode
private java.util.List<Adapter> _adapters = new java.util.LinkedList<>();
private java.util.List<DbEnv> _dbEnvs = new java.util.LinkedList<>();
- private java.util.List<MetricsView> _metrics = new java.util.LinkedList<>();
private boolean _started = false;
- private boolean _metricsRetrieved = false;
-
- private ShowIceLogDialog _showIceLogDialog;
static private ServiceEditor _editor;
static private DefaultTreeCellRenderer _cellRenderer;
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java
index 477b9f78ed7..09f24eda5fc 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/ServiceEditor.java
@@ -9,18 +9,12 @@
package com.zeroc.IceGridGUI.LiveDeployment;
-import java.awt.event.ActionEvent;
-
-import javax.swing.AbstractAction;
-import javax.swing.Action;
-import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JToolBar;
import com.jgoodies.forms.builder.DefaultFormBuilder;
-import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.looks.Options;
import com.jgoodies.looks.HeaderStyle;
@@ -47,25 +41,11 @@ class ServiceEditor extends CommunicatorEditor
_coordinator = coordinator;
_entry.setEditable(false);
_started.setEnabled(false);
-
- _buildId.setEditable(false);
-
- Action refresh = new AbstractAction("Refresh")
- {
- @Override
- public void actionPerformed(ActionEvent e)
- {
- _buildId.setText("Retrieving...");
- _properties.clear();
- _target.showRuntimeProperties();
- }
- };
- refresh.putValue(Action.SHORT_DESCRIPTION, "Reread the properties from the service");
- _refreshButton = new JButton(refresh);
}
void show(Service service)
{
+ Service previous = (Service)_target;
_target = service;
ServiceDescriptor descriptor = service.getServiceDescriptor();
@@ -76,25 +56,15 @@ class ServiceEditor extends CommunicatorEditor
_started.setSelected(service.isStarted());
Server server = (Server)service.getParent();
-
int iceIntVersion = server.getIceVersion();
if(server.getState() == ServerState.Active && (iceIntVersion == 0 || iceIntVersion >= 30300))
{
- _buildId.setText("Retrieving...");
- _properties.clear();
-
- //
- // Retrieve all properties in background
- //
- _target.showRuntimeProperties();
- _refreshButton.setEnabled(true);
+ showRuntimeProperties(previous);
}
else
{
- _buildId.setText("");
- _properties.clear();
- _refreshButton.setEnabled(false);
+ clearRuntimeProperties("");
}
}
@@ -105,31 +75,10 @@ class ServiceEditor extends CommunicatorEditor
builder.append("", _started);
builder.nextLine();
-
- builder.append("Build Id");
- builder.append(_buildId, _refreshButton);
- builder.nextLine();
-
- builder.append("Properties");
- builder.nextLine();
- builder.append("");
- builder.nextLine();
- builder.append("");
-
- builder.nextLine();
- builder.append("");
-
- builder.nextRow(-6);
- CellConstraints cc = new CellConstraints();
- JScrollPane scrollPane = new JScrollPane(_properties);
- builder.add(scrollPane, cc.xywh(builder.getColumn(), builder.getRow(), 3, 7));
- builder.nextRow(6);
- builder.nextLine();
+ appendRuntimeProperties(builder);
builder.appendSeparator("Configuration");
-
- super.appendProperties(builder);
-
+ appendDescriptorProperties(builder);
builder.append("Entry Point");
builder.append(_entry, 3);
builder.nextLine();
@@ -142,42 +91,6 @@ class ServiceEditor extends CommunicatorEditor
_propertiesPanel.setName("Service Properties");
}
- void setBuildId(String buildString, Service service)
- {
- //
- // That's to report error messages
- //
-
- if(service == _target)
- {
- _buildId.setText(buildString);
- }
- //
- // Otherwise we've already moved to another server
- //
- }
-
- void setRuntimeProperties(java.util.SortedMap<String, String> map, Service service)
- {
- if(service == _target )
- {
- _properties.setSortedMap(map);
-
- String buildString = map.get("BuildId");
- if(buildString == null)
- {
- _buildId.setText("");
- }
- else
- {
- _buildId.setText(buildString);
- }
- }
- //
- // Otherwise we've already moved to another server
- //
- }
-
private class ToolBar extends JToolBar
{
private ToolBar()
@@ -195,11 +108,7 @@ class ServiceEditor extends CommunicatorEditor
}
private final Coordinator _coordinator;
- private Service _target;
private JTextField _entry = new JTextField(20);
private JCheckBox _started = new JCheckBox("Started");
- private JTextField _buildId = new JTextField(20);
- private JButton _refreshButton;
- private TableField _properties = new TableField("Name", "Value");
private JToolBar _toolBar;
}
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java
index 256b8db17f9..f468f09b028 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/Slave.java
@@ -12,13 +12,14 @@ package com.zeroc.IceGridGUI.LiveDeployment;
import java.awt.Component;
import java.awt.Cursor;
+import javax.swing.Icon;
import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;
import com.zeroc.IceGrid.*;
import com.zeroc.IceGridGUI.*;
-class Slave extends TreeNode
+class Slave extends Communicator
{
//
// Actions
@@ -28,6 +29,7 @@ class Slave extends TreeNode
{
boolean[] actions = new boolean[com.zeroc.IceGridGUI.LiveDeployment.TreeNode.ACTION_COUNT];
actions[SHUTDOWN_REGISTRY] = true;
+ actions[RETRIEVE_ICE_LOG] = true;
actions[RETRIEVE_STDOUT] = true;
actions[RETRIEVE_STDERR] = true;
return actions;
@@ -104,6 +106,7 @@ class Slave extends TreeNode
if(_popup == null)
{
_popup = new JPopupMenu();
+ _popup.add(la.get(RETRIEVE_ICE_LOG));
_popup.add(la.get(RETRIEVE_STDOUT));
_popup.add(la.get(RETRIEVE_STDERR));
_popup.addSeparator();
@@ -121,10 +124,31 @@ class Slave extends TreeNode
{
_editor = new SlaveEditor();
}
- _editor.show(_info);
+ _editor.show(this);
return _editor;
}
+ //
+ // Communicator overrides
+ //
+ @Override
+ protected java.util.concurrent.CompletableFuture<com.zeroc.Ice.ObjectPrx> getAdminAsync()
+ {
+ return getRoot().getCoordinator().getSession().getAdmin().getRegistryAdminAsync(_id);
+ }
+
+ @Override
+ protected String getDisplayName()
+ {
+ return "Registry Slave " + _id;
+ }
+
+ @Override
+ protected String getDefaultFileName()
+ {
+ return "registry-" + _instanceName + "-" + _id;
+ }
+
@Override
public Component getTreeCellRendererComponent(
JTree tree,
@@ -140,23 +164,34 @@ class Slave extends TreeNode
//
// TODO: separate icon for master
//
-
_cellRenderer = new DefaultTreeCellRenderer();
- _cellRenderer.setLeafIcon(Utils.getIcon("/icons/16x16/registry.png"));
+
+ Icon icon = Utils.getIcon("/icons/16x16/registry.png");
+ _cellRenderer.setOpenIcon(icon);
+ _cellRenderer.setClosedIcon(icon);
}
return _cellRenderer.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
}
+ RegistryInfo
+ getInfo()
+ {
+ return _info;
+ }
+
Slave(TreeNode parent, RegistryInfo info, String instanceName)
{
- super(parent, info.name);
+ super(parent, info.name, 1);
+ _childrenArray[0] = _metrics;
_info = info;
_title = instanceName + " (" + info.name + ")";
+ _instanceName = instanceName;
}
private final RegistryInfo _info;
private final String _title;
+ private final String _instanceName;
static private DefaultTreeCellRenderer _cellRenderer;
static private SlaveEditor _editor;
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java
index 681fe1f022e..30df0403125 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/SlaveEditor.java
@@ -15,16 +15,20 @@ import com.jgoodies.forms.builder.DefaultFormBuilder;
import com.zeroc.IceGrid.*;
-class SlaveEditor extends Editor
+class SlaveEditor extends CommunicatorEditor
{
SlaveEditor()
{
_hostname.setEditable(false);
}
- void show(RegistryInfo info)
+ void show(Slave slave)
{
- _hostname.setText(info.hostname);
+ Slave previous = (Slave)_target;
+ _target = slave;
+
+ _hostname.setText(slave.getInfo().hostname);
+ showRuntimeProperties(previous);
}
@Override
@@ -33,6 +37,7 @@ class SlaveEditor extends Editor
builder.append("Hostname" );
builder.append(_hostname, 3);
builder.nextLine();
+ appendRuntimeProperties(builder);
}
@Override
diff --git a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java
index 8c455213d3e..f4b80d37d82 100644
--- a/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java
+++ b/java/src/IceGridGUI/src/main/java/com/zeroc/IceGridGUI/LiveDeployment/TreeNode.java
@@ -142,7 +142,6 @@ public abstract class TreeNode extends TreeNodeBase
{
assert false;
}
-
public void clearShowIceLogDialog()
{
assert false;
@@ -177,7 +176,7 @@ public abstract class TreeNode extends TreeNodeBase
SwingUtilities.invokeLater(() -> success(prefix, detail));
}
- protected void amiFailure(String prefix, String title, com.zeroc.Ice.UserException e)
+ protected void amiFailure(String prefix, String title, Throwable e)
{
if(e instanceof com.zeroc.IceGrid.ServerNotExistException)
{
@@ -227,7 +226,7 @@ public abstract class TreeNode extends TreeNodeBase
}
else
{
- amiFailure(prefix, title, e.toString());
+ amiFailure(prefix, title, title + ":\n" + e.toString());
}
}