summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'java/src')
-rwxr-xr-xjava/src/IceGrid/TreeNode/Application.java52
-rwxr-xr-xjava/src/IceGrid/TreeNode/CommonBaseI.java85
-rwxr-xr-xjava/src/IceGrid/TreeNode/Node.java53
-rwxr-xr-xjava/src/IceGrid/TreeNode/Server.java62
4 files changed, 137 insertions, 115 deletions
diff --git a/java/src/IceGrid/TreeNode/Application.java b/java/src/IceGrid/TreeNode/Application.java
index e54879f4056..8d854089534 100755
--- a/java/src/IceGrid/TreeNode/Application.java
+++ b/java/src/IceGrid/TreeNode/Application.java
@@ -243,58 +243,6 @@ public class Application extends EditableParent
_model.showActions(_model.getSelectedNode());
}
-
- private void amiSuccess(final String prefix)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- _model.getStatusBar().setText(prefix + "done.");
- }
- });
- }
-
- private void amiFailure(String prefix, String title, Ice.UserException e)
- {
- if(e instanceof IceGrid.ApplicationNotExistException)
- {
- amiFailure(prefix, title, "This application was not registered with the IceGrid Registry");
- }
- else if(e instanceof IceGrid.PatchException)
- {
- IceGrid.PatchException pe = (IceGrid.PatchException)e;
- amiFailure(prefix, title, pe.reason);
- }
- else
- {
- amiFailure(prefix, title, e.toString());
- }
- }
-
- private void amiFailure(final String prefix, final String title, final String message)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- failure(prefix, title, message);
- }
- });
- }
-
- private void failure(String prefix, String title, String message)
- {
- _model.getStatusBar().setText(prefix + "failed!");
-
- JOptionPane.showMessageDialog(
- _model.getMainFrame(),
- message,
- title,
- JOptionPane.ERROR_MESSAGE);
- }
-
-
public ApplicationUpdateDescriptor createUpdateDescriptor()
{
ApplicationUpdateDescriptor update = new ApplicationUpdateDescriptor();
diff --git a/java/src/IceGrid/TreeNode/CommonBaseI.java b/java/src/IceGrid/TreeNode/CommonBaseI.java
index 6ad65ba4137..e5a08edf860 100755
--- a/java/src/IceGrid/TreeNode/CommonBaseI.java
+++ b/java/src/IceGrid/TreeNode/CommonBaseI.java
@@ -9,10 +9,12 @@
package IceGrid.TreeNode;
import java.awt.Component;
+import javax.swing.JOptionPane;
import javax.swing.JPopupMenu;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTree;
+import javax.swing.SwingUtilities;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import javax.swing.event.TreeModelEvent;
@@ -371,6 +373,89 @@ abstract class CommonBaseI implements CommonBase
{
return _model;
}
+
+ protected void amiSuccess(final String prefix)
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ _model.getStatusBar().setText(prefix + "done.");
+ }
+ });
+ }
+
+ protected void amiFailure(String prefix, String title, Ice.UserException e)
+ {
+ if(e instanceof IceGrid.ServerNotExistException)
+ {
+ IceGrid.ServerNotExistException sne =
+ (IceGrid.ServerNotExistException)e;
+
+ amiFailure(prefix, title,
+ "Server '" + sne.id +
+ "' was not registered with the IceGrid Registry");
+ }
+ else if(e instanceof IceGrid.ServerStartException)
+ {
+ IceGrid.ServerStartException ste = (IceGrid.ServerStartException)e;
+ amiFailure(prefix, title, "Server '" +
+ ste.id + "' did not start: " + ste.reason);
+ }
+ else if(e instanceof IceGrid.ApplicationNotExistException)
+ {
+ amiFailure(prefix, title,
+ "This application was not registered with the IceGrid Registry");
+ }
+ else if(e instanceof IceGrid.PatchException)
+ {
+ IceGrid.PatchException pe = (IceGrid.PatchException)e;
+ amiFailure(prefix, title, pe.reason);
+ }
+ else if(e instanceof IceGrid.NodeNotExistException)
+ {
+ IceGrid.NodeNotExistException nnee =
+ (IceGrid.NodeNotExistException)e;
+
+ amiFailure(prefix, title,
+ "Node '" + nnee.name +
+ " 'was not registered with the IceGrid Registry.");
+ }
+ else if(e instanceof IceGrid.NodeUnreachableException)
+ {
+ IceGrid.NodeUnreachableException nue =
+ (IceGrid.NodeUnreachableException)e;
+ amiFailure(prefix, title, "Node '" +
+ nue.name + "' is unreachable: " + nue.reason);
+ }
+ else
+ {
+ amiFailure(prefix, title, e.toString());
+ }
+ }
+
+ protected void amiFailure(final String prefix,
+ final String title, final String message)
+ {
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ failure(prefix, title, message);
+ }
+ });
+ }
+
+ protected void failure(String prefix, String title, String message)
+ {
+ _model.getStatusBar().setText(prefix + "failed!");
+
+ JOptionPane.showMessageDialog(
+ _model.getMainFrame(),
+ message,
+ title,
+ JOptionPane.ERROR_MESSAGE);
+ }
protected TreePath _path;
protected Parent _parent;
diff --git a/java/src/IceGrid/TreeNode/Node.java b/java/src/IceGrid/TreeNode/Node.java
index 484439b3382..75e7bad94d9 100755
--- a/java/src/IceGrid/TreeNode/Node.java
+++ b/java/src/IceGrid/TreeNode/Node.java
@@ -9,6 +9,8 @@
package IceGrid.TreeNode;
import java.awt.Component;
+import java.awt.Cursor;
+
import javax.swing.Icon;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
@@ -18,6 +20,8 @@ import javax.swing.JTree;
import javax.swing.tree.TreeCellRenderer;
import javax.swing.tree.DefaultTreeCellRenderer;
+import IceGrid.AMI_Admin_shutdownNode;
+
import IceGrid.NodeDescriptor;
import IceGrid.NodeInfo;
import IceGrid.Model;
@@ -149,8 +153,55 @@ class Node extends EditableParent
}
public void shutdownNode()
{
- // TODO: implement!
+ final String prefix = "Shutting down node '" + _id + "'...";
+ _model.getStatusBar().setText(prefix);
+
+ AMI_Admin_shutdownNode cb = new AMI_Admin_shutdownNode()
+ {
+ //
+ // Called by another thread!
+ //
+ public void ice_response()
+ {
+ amiSuccess(prefix);
+ }
+
+ public void ice_exception(Ice.UserException e)
+ {
+ amiFailure(prefix, "Failed to shutdown " + _id, e);
+ }
+
+ public void ice_exception(Ice.LocalException e)
+ {
+ amiFailure(prefix, "Failed to shutdown " + _id,
+ e.toString());
+ }
+ };
+
+ try
+ {
+ _model.getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+ _model.getAdmin().shutdownNode_async(cb, _id);
+ }
+ catch(Ice.LocalException e)
+ {
+ failure(prefix, "Failed to shutdown " + _id, e.toString());
+ }
+ finally
+ {
+ _model.getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+
+
+ //
+ // Recompute actions in case this comes from popup menu
+ //
+ _model.showActions(_model.getSelectedNode());
}
+
public boolean destroy()
{
diff --git a/java/src/IceGrid/TreeNode/Server.java b/java/src/IceGrid/TreeNode/Server.java
index 7ae59f2e635..9d10b23143e 100755
--- a/java/src/IceGrid/TreeNode/Server.java
+++ b/java/src/IceGrid/TreeNode/Server.java
@@ -426,68 +426,6 @@ class Server extends EditableParent
_model.showActions(_model.getSelectedNode());
}
-
- private void amiSuccess(final String prefix)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- _model.getStatusBar().setText(prefix + "done.");
- }
- });
- }
-
- private void amiFailure(String prefix, String title, Ice.UserException e)
- {
- if(e instanceof IceGrid.ServerNotExistException)
- {
- amiFailure(prefix, title, "This server was not registered with the IceGrid Registry");
- }
- else if(e instanceof IceGrid.NodeUnreachableException)
- {
- IceGrid.NodeUnreachableException nue = (IceGrid.NodeUnreachableException)e;
- amiFailure(prefix, title, "Node '" + nue.name + "' is unreachable: " + nue.reason);
- }
- else if(e instanceof IceGrid.ServerStartException)
- {
- IceGrid.ServerStartException ste = (IceGrid.ServerStartException)e;
- amiFailure(prefix, title, ste.reason);
- }
- else if(e instanceof IceGrid.PatchException)
- {
- IceGrid.PatchException pe = (IceGrid.PatchException)e;
- amiFailure(prefix, title, pe.reason);
- }
- else
- {
- amiFailure(prefix, title, e.toString());
- }
- }
-
- private void amiFailure(final String prefix, final String title, final String message)
- {
- SwingUtilities.invokeLater(new Runnable()
- {
- public void run()
- {
- failure(prefix, title, message);
- }
- });
- }
-
- private void failure(String prefix, String title, String message)
- {
- _model.getStatusBar().setText(prefix + "failed!");
-
- JOptionPane.showMessageDialog(
- _model.getMainFrame(),
- message,
- title,
- JOptionPane.ERROR_MESSAGE);
- }
-
-
private void enableServer(boolean enable)
{
final String prefix = (enable ?