summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xjava/src/IceGridGUI/Application/Editor.java20
-rwxr-xr-xjava/src/IceGridGUI/Application/ServerInstance.java2
-rwxr-xr-xjava/src/IceGridGUI/Application/ServiceInstance.java2
-rwxr-xr-xjava/src/IceGridGUI/Coordinator.java64
-rwxr-xr-xjava/src/IceGridGUI/EditorBase.java72
-rwxr-xr-xjava/src/IceGridGUI/LiveActions.java11
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/Adapter.java2
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/NodeEditor.java10
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/ObjectDialog.java120
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/RegistryEditor.java123
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/Root.java284
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/Server.java5
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/TableField.java67
-rwxr-xr-xjava/src/IceGridGUI/LiveDeployment/TreeNode.java13
-rwxr-xr-xjava/src/IceGridGUI/RegistryObserverI.java50
15 files changed, 751 insertions, 94 deletions
diff --git a/java/src/IceGridGUI/Application/Editor.java b/java/src/IceGridGUI/Application/Editor.java
index 936e436a408..9eea269f02c 100755
--- a/java/src/IceGridGUI/Application/Editor.java
+++ b/java/src/IceGridGUI/Application/Editor.java
@@ -37,6 +37,26 @@ import IceGridGUI.*;
public class Editor extends EditorBase
{
+ static public java.util.Map makeParameterValues(
+ java.util.Map oldParameterValues,
+ java.util.List newParameters)
+ {
+ java.util.Map result = new java.util.HashMap();
+
+ java.util.Iterator p = newParameters.iterator();
+ while(p.hasNext())
+ {
+ Object name = p.next();
+ Object value = oldParameterValues.get(name);
+ if(value != null)
+ {
+ result.put(name, value);
+ }
+ }
+ return result;
+ }
+
+
protected void applyUpdate()
{
assert false;
diff --git a/java/src/IceGridGUI/Application/ServerInstance.java b/java/src/IceGridGUI/Application/ServerInstance.java
index f038aa1a7a6..380c6cc5621 100755
--- a/java/src/IceGridGUI/Application/ServerInstance.java
+++ b/java/src/IceGridGUI/Application/ServerInstance.java
@@ -223,7 +223,7 @@ class ServerInstance extends TreeNode implements Server
if(!parameters.equals(_descriptor.parameterValues.keySet()))
{
backup.parameterValues = _descriptor.parameterValues;
- _descriptor.parameterValues = EditorBase.makeParameterValues(
+ _descriptor.parameterValues = Editor.makeParameterValues(
_descriptor.parameterValues, templateDescriptor.parameters);
}
ServerInstance newServer = node.createServer(false, _descriptor);
diff --git a/java/src/IceGridGUI/Application/ServiceInstance.java b/java/src/IceGridGUI/Application/ServiceInstance.java
index 8ca8db73b63..937b3dcae5c 100755
--- a/java/src/IceGridGUI/Application/ServiceInstance.java
+++ b/java/src/IceGridGUI/Application/ServiceInstance.java
@@ -223,7 +223,7 @@ class ServiceInstance extends TreeNode implements Service, Cloneable
if(!parameters.equals(_descriptor.parameterValues.keySet()))
{
backup.parameterValues = _descriptor.parameterValues;
- _descriptor.parameterValues = EditorBase.makeParameterValues(
+ _descriptor.parameterValues = Editor.makeParameterValues(
_descriptor.parameterValues, templateDescriptor.parameters);
editables.add(getEnclosingEditable());
}
diff --git a/java/src/IceGridGUI/Coordinator.java b/java/src/IceGridGUI/Coordinator.java
index 1ed6f4876bb..461d381b9f9 100755
--- a/java/src/IceGridGUI/Coordinator.java
+++ b/java/src/IceGridGUI/Coordinator.java
@@ -236,6 +236,14 @@ public class Coordinator
_nodeMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE));
//
+ // Registry sub-menu
+ //
+ _registryMenu = new JMenu("Registry");
+ _registryMenu.setEnabled(false);
+ toolsMenu.add(_registryMenu);
+ _registryMenu.add(_liveActionsForMenu.get(IceGridGUI.LiveDeployment.TreeNode.ADD_OBJECT));
+
+ //
// Server sub-menu
//
_serverMenu = new JMenu("Server");
@@ -438,12 +446,14 @@ public class Coordinator
//
// From the Registry observer:
//
- void registryInit(int serial, final java.util.List applications)
+ void registryInit(int serial, java.util.List applications,
+ AdapterInfo[] adapters, ObjectInfo[] objects)
{
assert _latestSerial == -1;
_latestSerial = serial;
- _liveDeploymentRoot.init(_admin.ice_getIdentity().category, applications);
+ _liveDeploymentRoot.init(_admin.ice_getIdentity().category,
+ applications, adapters, objects);
//
// When we get this init, we can't have any live Application yet.
//
@@ -493,6 +503,48 @@ public class Coordinator
}
updateSerial(serial);
}
+
+ void adapterAdded(int serial, AdapterInfo info)
+ {
+ _liveDeploymentRoot.adapterAdded(info);
+ _liveDeploymentPane.refresh();
+ updateSerial(serial);
+ }
+
+ void adapterUpdated(int serial, AdapterInfo info)
+ {
+ _liveDeploymentRoot.adapterUpdated(info);
+ _liveDeploymentPane.refresh();
+ updateSerial(serial);
+ }
+
+ void adapterRemoved(int serial, String id)
+ {
+ _liveDeploymentRoot.adapterRemoved(id);
+ _liveDeploymentPane.refresh();
+ updateSerial(serial);
+ }
+
+ void objectAdded(int serial, ObjectInfo info)
+ {
+ _liveDeploymentRoot.objectAdded(info);
+ _liveDeploymentPane.refresh();
+ updateSerial(serial);
+ }
+
+ void objectUpdated(int serial, ObjectInfo info)
+ {
+ _liveDeploymentRoot.objectUpdated(info);
+ _liveDeploymentPane.refresh();
+ updateSerial(serial);
+ }
+
+ void objectRemoved(int serial, Ice.Identity id)
+ {
+ _liveDeploymentRoot.objectRemoved(id);
+ _liveDeploymentPane.refresh();
+ updateSerial(serial);
+ }
public void accessDenied(AccessDeniedException e)
{
@@ -1513,7 +1565,7 @@ public class Coordinator
}
};
- _installDistribution = new AbstractAction("Install distribution")
+ _installDistribution = new AbstractAction("Patch distribution")
{
public void actionPerformed(ActionEvent e)
{
@@ -1524,7 +1576,6 @@ public class Coordinator
};
_installDistribution.setEnabled(false);
-
_showVarsMenuItem = new
JCheckBoxMenuItem(_appActionsForMenu.get(IceGridGUI.Application.TreeNode.SHOW_VARS));
_showVarsTool = new
@@ -1855,6 +1906,9 @@ public class Coordinator
_nodeMenu.setEnabled(
availableActions[IceGridGUI.LiveDeployment.TreeNode.SHUTDOWN_NODE]);
+ _registryMenu.setEnabled(
+ availableActions[IceGridGUI.LiveDeployment.TreeNode.ADD_OBJECT]);
+
_serverMenu.setEnabled(
availableActions[IceGridGUI.LiveDeployment.TreeNode.START] ||
availableActions[IceGridGUI.LiveDeployment.TreeNode.STOP] ||
@@ -1886,6 +1940,7 @@ public class Coordinator
_appMenu.setEnabled(false);
_nodeMenu.setEnabled(false);
+ _registryMenu.setEnabled(false);
_serverMenu.setEnabled(false);
_serviceMenu.setEnabled(
availableActions[IceGridGUI.Application.TreeNode.MOVE_UP] ||
@@ -1982,6 +2037,7 @@ public class Coordinator
private JMenu _newTemplateMenu;
private JMenu _appMenu;
private JMenu _nodeMenu;
+ private JMenu _registryMenu;
private JMenu _serverMenu;
private JMenu _serviceMenu;
diff --git a/java/src/IceGridGUI/EditorBase.java b/java/src/IceGridGUI/EditorBase.java
index 201ec6e7e80..b9c8ac4d712 100755
--- a/java/src/IceGridGUI/EditorBase.java
+++ b/java/src/IceGridGUI/EditorBase.java
@@ -40,77 +40,7 @@ public abstract class EditorBase
{
return null;
}
-
-
-
- static public java.util.SortedMap propertiesToMap(java.util.List props,
- Utils.Resolver resolver)
- {
- java.util.SortedMap result = new java.util.TreeMap();
- java.util.Iterator p = props.iterator();
- while(p.hasNext())
- {
- PropertyDescriptor pd = (PropertyDescriptor)p.next();
- String name = (String)pd.name;
- String val = (String)pd.value;
- if(resolver != null)
- {
- name = resolver.substitute(pd.name);
- val = resolver.substitute(pd.value);
- }
- result.put(name, val);
- }
- return result;
- }
-
- static public java.util.Vector mapToVector(java.util.Map map)
- {
- java.util.Vector result = new java.util.Vector(map.size());
- java.util.Iterator p = map.entrySet().iterator();
- while(p.hasNext())
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- java.util.Vector row = new java.util.Vector(2);
- row.add(entry.getKey());
- row.add(entry.getValue());
- result.add(row);
- }
- return result;
- }
-
- static public java.util.LinkedList mapToProperties(java.util.Map map)
- {
- java.util.LinkedList result = new java.util.LinkedList();
- java.util.Iterator p = map.entrySet().iterator();
- while(p.hasNext())
- {
- java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
- String name = (String)entry.getKey();
- String value = (String)entry.getValue();
- result.add(new PropertyDescriptor(name, value));
- }
- return result;
- }
-
- static public java.util.Map makeParameterValues(
- java.util.Map oldParameterValues,
- java.util.List newParameters)
- {
- java.util.Map result = new java.util.HashMap();
-
- java.util.Iterator p = newParameters.iterator();
- while(p.hasNext())
- {
- Object name = p.next();
- Object value = oldParameterValues.get(name);
- if(value != null)
- {
- result.put(name, value);
- }
- }
- return result;
- }
-
+
protected abstract void appendProperties(DefaultFormBuilder builder);
protected void buildPropertiesPanel()
diff --git a/java/src/IceGridGUI/LiveActions.java b/java/src/IceGridGUI/LiveActions.java
index 173025c3f9d..1f7335f9569 100755
--- a/java/src/IceGridGUI/LiveActions.java
+++ b/java/src/IceGridGUI/LiveActions.java
@@ -104,13 +104,22 @@ public class LiveActions
};
_array[TreeNode.SERVER_INSTALL_DISTRIBUTION] =
- new AbstractAction("Patch")
+ new AbstractAction("Patch distribution")
{
public void actionPerformed(ActionEvent e)
{
_target.serverInstallDistribution();
}
};
+
+ _array[TreeNode.ADD_OBJECT] =
+ new AbstractAction("Add well-known object")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ _target.addObject();
+ }
+ };
}
private TreeNode _target;
diff --git a/java/src/IceGridGUI/LiveDeployment/Adapter.java b/java/src/IceGridGUI/LiveDeployment/Adapter.java
index 046beb29ac4..e22761a93a2 100755
--- a/java/src/IceGridGUI/LiveDeployment/Adapter.java
+++ b/java/src/IceGridGUI/LiveDeployment/Adapter.java
@@ -145,7 +145,7 @@ class Adapter extends TreeNode
}
else
{
- String str = getCoordinator().getCommunicator().proxyToString(proxy);
+ String str = proxy.toString();
int index = str.indexOf(':');
if(index == -1 || index == str.length() - 1)
{
diff --git a/java/src/IceGridGUI/LiveDeployment/NodeEditor.java b/java/src/IceGridGUI/LiveDeployment/NodeEditor.java
index fc790b6ed96..eda518520fd 100755
--- a/java/src/IceGridGUI/LiveDeployment/NodeEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/NodeEditor.java
@@ -10,20 +10,16 @@ package IceGridGUI.LiveDeployment;
import java.awt.event.ActionEvent;
-import com.jgoodies.forms.builder.DefaultFormBuilder;
-import com.jgoodies.forms.layout.CellConstraints;
-
import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.JButton;
-import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
-import javax.swing.JTable;
import javax.swing.JTextField;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.table.DefaultTableCellRenderer;
+import com.jgoodies.forms.builder.DefaultFormBuilder;
+import com.jgoodies.forms.layout.CellConstraints;
+
import IceGrid.*;
import IceGridGUI.*;
diff --git a/java/src/IceGridGUI/LiveDeployment/ObjectDialog.java b/java/src/IceGridGUI/LiveDeployment/ObjectDialog.java
new file mode 100755
index 00000000000..c63727d9878
--- /dev/null
+++ b/java/src/IceGridGUI/LiveDeployment/ObjectDialog.java
@@ -0,0 +1,120 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2006 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 IceGridGUI.LiveDeployment;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.Frame;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BoxLayout;
+import javax.swing.JButton;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JDialog;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+
+import com.jgoodies.forms.builder.DefaultFormBuilder;
+import com.jgoodies.forms.factories.Borders;
+import com.jgoodies.forms.factories.ButtonBarFactory;
+import com.jgoodies.forms.layout.FormLayout;
+import com.jgoodies.forms.util.LayoutStyle;
+
+class ObjectDialog extends JDialog
+{
+ ObjectDialog(final Root root)
+ {
+ super(root.getCoordinator().getMainFrame(),
+ "New Well-Known Object - IceGrid Admin", true);
+ setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);
+ _mainFrame = root.getCoordinator().getMainFrame();
+
+ _type.setEditable(true);
+
+ JButton okButton = new JButton("OK");
+ ActionListener okListener = new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ String type = null;
+ if(_type.getSelectedItem() != QUERY_OBJECT)
+ {
+ type = _type.getSelectedItem().toString();
+ }
+
+ if(root.addObject(_proxy.getText(),type))
+ {
+ setVisible(false);
+ }
+ }
+ };
+ okButton.addActionListener(okListener);
+ getRootPane().setDefaultButton(okButton);
+
+ JButton cancelButton = new JButton("Cancel");
+ ActionListener cancelListener = new ActionListener()
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ setVisible(false);
+ }
+ };
+ cancelButton.addActionListener(cancelListener);
+
+ FormLayout layout = new FormLayout("right:pref, 3dlu, pref", "");
+ DefaultFormBuilder builder = new DefaultFormBuilder(layout);
+ builder.setDefaultDialogBorder();
+ builder.setRowGroupingEnabled(true);
+ builder.setLineGapSize(LayoutStyle.getCurrent().getLinePad());
+
+ builder.append("Proxy", _proxy);
+ builder.nextLine();
+ builder.append("Type", _type);
+ builder.nextLine();
+
+ JComponent buttonBar =
+ ButtonBarFactory.buildOKCancelBar(okButton, cancelButton);
+ buttonBar.setBorder(Borders.DIALOG_BORDER);
+
+ Container contentPane = getContentPane();
+ contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
+ contentPane.add(builder.getPanel());
+ contentPane.add(buttonBar);
+
+ pack();
+ setResizable(false);
+ }
+
+ void showDialog()
+ {
+ _proxy.setText("");
+ _type.setSelectedItem(QUERY_OBJECT);
+ setLocationRelativeTo(_mainFrame);
+ setVisible(true);
+ }
+
+ private JTextField _proxy = new JTextField(30);
+ private JComboBox _type = new JComboBox(new Object[]{QUERY_OBJECT});
+ private JFrame _mainFrame;
+
+ static private final Object QUERY_OBJECT = new Object()
+ {
+ public String toString()
+ {
+ return "Query object to retrieve type";
+ }
+ };
+
+}
diff --git a/java/src/IceGridGUI/LiveDeployment/RegistryEditor.java b/java/src/IceGridGUI/LiveDeployment/RegistryEditor.java
index 42f3820204c..e6e34b2e44b 100755
--- a/java/src/IceGridGUI/LiveDeployment/RegistryEditor.java
+++ b/java/src/IceGridGUI/LiveDeployment/RegistryEditor.java
@@ -8,19 +8,140 @@
// **********************************************************************
package IceGridGUI.LiveDeployment;
+import java.awt.event.ActionEvent;
+
+import javax.swing.AbstractAction;
+import javax.swing.Action;
+import javax.swing.JButton;
+import javax.swing.JLabel;
+import javax.swing.JScrollPane;
+import javax.swing.JTextField;
+import javax.swing.KeyStroke;
+
import com.jgoodies.forms.builder.DefaultFormBuilder;
+import com.jgoodies.forms.layout.CellConstraints;
import IceGrid.*;
import IceGridGUI.*;
class RegistryEditor extends Editor
{
+ RegistryEditor()
+ {
+ Action deleteObject = new AbstractAction("Remove selected object")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ int selectedRow = _objects.getSelectedRow();
+ if(selectedRow != -1)
+ {
+ _target.removeObject((String)_objects.getValueAt(selectedRow, 0));
+ }
+ }
+ };
+ _objects.getActionMap().put("delete", deleteObject);
+ _objects.getInputMap().put(
+ KeyStroke.getKeyStroke("DELETE"), "delete");
+
+
+ Action addObject = new AbstractAction("Add a new well-known object")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ _target.addObject();
+ }
+ };
+ _objects.getActionMap().put("insert", addObject);
+ _objects.getInputMap().put(
+ KeyStroke.getKeyStroke("INSERT"), "insert");
+
+ _objects.setToolTipText("<html>Well-known objects registered through the Admin interface.<br>"
+ + "Well-known objects registered using Adapter or Replica Group<br>"
+ + "definitions are not displayed here.</html>");
+
+ Action deleteAdapter = new AbstractAction("Remove selected adapter")
+ {
+ public void actionPerformed(ActionEvent e)
+ {
+ int selectedRow = _adapters.getSelectedRow();
+ if(selectedRow != -1)
+ {
+ _target.removeAdapter((String)_adapters.getValueAt(selectedRow, 0));
+ }
+ }
+ };
+ _adapters.getActionMap().put("delete", deleteAdapter);
+ _adapters.getInputMap().put(
+ KeyStroke.getKeyStroke("DELETE"), "delete");
+ _adapters.setToolTipText("<html>Adapters registered dynamically.</html>");
+ }
+
protected void appendProperties(DefaultFormBuilder builder)
- {}
+ {
+ CellConstraints cc = new CellConstraints();
+
+ builder.append("Dynamic Well-Known Objects");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextRow(-14);
+ JScrollPane scrollPane = new JScrollPane(_objects);
+ scrollPane.setToolTipText(_objects.getToolTipText());
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 14));
+ builder.nextRow(14);
+ builder.nextLine();
+
+ builder.append("Dynamic Adapters");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextLine();
+ builder.append("");
+ builder.nextRow(-14);
+ scrollPane = new JScrollPane(_adapters);
+ scrollPane.setToolTipText(_adapters.getToolTipText());
+ builder.add(scrollPane,
+ cc.xywh(builder.getColumn(), builder.getRow(), 3, 14));
+ builder.nextRow(14);
+ builder.nextLine();
+ }
protected void buildPropertiesPanel()
{
super.buildPropertiesPanel();
_propertiesPanel.setName("Registry Properties");
}
+
+ void show(Root root)
+ {
+ _target = root;
+ _objects.setObjects(root.getObjects());
+ _adapters.setAdapters(root.getAdapters());
+ }
+
+
+ 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/LiveDeployment/Root.java b/java/src/IceGridGUI/LiveDeployment/Root.java
index 7dc2766f82e..c13a6797ff1 100755
--- a/java/src/IceGridGUI/LiveDeployment/Root.java
+++ b/java/src/IceGridGUI/LiveDeployment/Root.java
@@ -8,6 +8,10 @@
// **********************************************************************
package IceGridGUI.LiveDeployment;
+import java.awt.Cursor;
+
+import javax.swing.JOptionPane;
+import javax.swing.JPopupMenu;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreePath;
@@ -29,6 +33,14 @@ public class Root extends ListTreeNode
_tree = new JTree(this, true);
_treeModel = (DefaultTreeModel)_tree.getModel();
+ _objectDialog = new ObjectDialog(this);
+ }
+
+ public boolean[] getAvailableActions()
+ {
+ boolean[] actions = new boolean[ACTION_COUNT];
+ actions[ADD_OBJECT] = true;
+ return actions;
}
public ApplicationDescriptor getApplicationDescriptor(String name)
@@ -47,14 +59,27 @@ public class Root extends ListTreeNode
{
_editor = new RegistryEditor();
}
+ _editor.show(this);
return _editor;
}
- public void init(String instanceName, java.util.List applications)
+ public void init(String instanceName, java.util.List applications,
+ AdapterInfo[] adapters, ObjectInfo[] objects)
{
_label = instanceName;
_tree.setRootVisible(true);
+ for(int i = 0; i < adapters.length; ++i)
+ {
+ _adapters.put(adapters[i].id, adapters[i]);
+ }
+
+ for(int i = 0; i < objects.length; ++i)
+ {
+ _objects.put(Ice.Util.identityToString(objects[i].proxy.ice_getIdentity()),
+ objects[i]);
+ }
+
java.util.Iterator p = applications.iterator();
while(p.hasNext())
{
@@ -67,6 +92,9 @@ public class Root extends ListTreeNode
//
public void clear()
{
+ _adapters.clear();
+ _objects.clear();
+
_descriptorMap.clear();
_children.clear();
_treeModel.nodeStructureChanged(this);
@@ -231,6 +259,37 @@ public class Root extends ListTreeNode
}
}
+ public void adapterAdded(AdapterInfo info)
+ {
+ _adapters.put(info.id, info);
+ }
+
+ public void adapterUpdated(AdapterInfo info)
+ {
+ _adapters.put(info.id, info);
+ }
+
+ public void adapterRemoved(String id)
+ {
+ _adapters.remove(id);
+ }
+
+ public void objectAdded(ObjectInfo info)
+ {
+ _objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
+ }
+
+ public void objectUpdated(ObjectInfo info)
+ {
+ _objects.put(Ice.Util.identityToString(info.proxy.ice_getIdentity()), info);
+ }
+
+ public void objectRemoved(Ice.Identity id)
+ {
+ _objects.remove(Ice.Util.identityToString(id));
+ }
+
+
//
// From the Node Observer:
//
@@ -279,6 +338,20 @@ public class Root extends ListTreeNode
}
}
+ public JPopupMenu getPopupMenu()
+ {
+ LiveActions la = getCoordinator().getLiveActionsForPopup();
+
+ if(_popup == null)
+ {
+ _popup = new JPopupMenu();
+ _popup.add(la.get(ADD_OBJECT));
+ }
+
+ la.setTarget(this);
+ return _popup;
+ }
+
public void setSelectedNode(TreeNode node)
{
_tree.setSelectionPath(node.getPath());
@@ -324,12 +397,208 @@ public class Root extends ListTreeNode
return true;
}
+ public void addObject()
+ {
+ _objectDialog.showDialog();
+ }
+
Root getRoot()
{
return this;
}
+ java.util.SortedMap getObjects()
+ {
+ return _objects;
+ }
+
+ java.util.SortedMap getAdapters()
+ {
+ return _adapters;
+ }
+
+
+ boolean addObject(String strProxy, String type)
+ {
+ Ice.ObjectPrx proxy = null;
+
+ try
+ {
+ proxy = _coordinator.getCommunicator().stringToProxy(strProxy);
+ }
+ catch(Ice.LocalException e)
+ {
+ JOptionPane.showMessageDialog(
+ _coordinator.getMainFrame(),
+ "Cannot parse proxy '" + strProxy + "'",
+ "addObject failed",
+ JOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+
+ if(proxy == null)
+ {
+ JOptionPane.showMessageDialog(
+ _coordinator.getMainFrame(),
+ "You must provide a non-null proxy",
+ "addObject failed",
+ JOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+
+ String strIdentity = Ice.Util.identityToString(proxy.ice_getIdentity());
+
+ String prefix = "Adding well-known object '" + strIdentity + "'...";
+ try
+ {
+ _coordinator.getStatusBar().setText(prefix);
+ _coordinator.getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+
+ if(type == null)
+ {
+ _coordinator.getAdmin().addObject(proxy);
+ }
+ else
+ {
+ _coordinator.getAdmin().addObjectWithType(proxy, type);
+ }
+ }
+ catch(ObjectExistsException e)
+ {
+ _coordinator.getStatusBar().setText(prefix + "failed.");
+ JOptionPane.showMessageDialog(
+ _coordinator.getMainFrame(),
+ "An object with this identity is already registered as a well-known object",
+ "addObject failed",
+ JOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+ catch(DeploymentException e)
+ {
+ _coordinator.getStatusBar().setText(prefix + "failed.");
+ JOptionPane.showMessageDialog(
+ _coordinator.getMainFrame(),
+ "Deployment exception: " + e.reason,
+ "addObject failed",
+ JOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+ catch(Ice.LocalException e)
+ {
+ _coordinator.getStatusBar().setText(prefix + "failed.");
+ JOptionPane.showMessageDialog(
+ _coordinator.getMainFrame(),
+ e.toString(),
+ "addObject failed",
+ JOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+ finally
+ {
+ _coordinator.getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ _coordinator.getStatusBar().setText(prefix + "done.");
+ return true;
+ }
+
+
+ void removeObject(String strProxy)
+ {
+ Ice.ObjectPrx proxy = _coordinator.getCommunicator().stringToProxy(strProxy);
+ Ice.Identity identity = proxy.ice_getIdentity();
+ final String strIdentity = Ice.Util.identityToString(identity);
+
+ final String prefix = "Removing well-known object '" + strIdentity + "'...";
+ _coordinator.getStatusBar().setText(prefix);
+
+ AMI_Admin_removeObject cb = new AMI_Admin_removeObject()
+ {
+ //
+ // Called by another thread!
+ //
+ public void ice_response()
+ {
+ amiSuccess(prefix);
+ }
+
+ public void ice_exception(Ice.UserException e)
+ {
+ amiFailure(prefix, "Failed to remove object '" + strIdentity + "'", e);
+ }
+
+ public void ice_exception(Ice.LocalException e)
+ {
+ amiFailure(prefix, "Failed to remove object '" + strIdentity + "'",
+ e.toString());
+ }
+ };
+
+ try
+ {
+ _coordinator.getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ _coordinator.getAdmin().removeObject_async(cb, identity);
+ }
+ catch(Ice.LocalException e)
+ {
+ failure(prefix, "Failed to remove object '" + strIdentity + "'",
+ e.toString());
+ }
+ finally
+ {
+ _coordinator.getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+
+ void removeAdapter(final String adapterId)
+ {
+ final String prefix = "Removing adapter '" + adapterId + "'...";
+ _coordinator.getStatusBar().setText(prefix);
+
+ AMI_Admin_removeAdapter cb = new AMI_Admin_removeAdapter()
+ {
+ //
+ // Called by another thread!
+ //
+ public void ice_response()
+ {
+ amiSuccess(prefix);
+ }
+
+ public void ice_exception(Ice.UserException e)
+ {
+ amiFailure(prefix, "Failed to remove adapter '" + adapterId + "'", e);
+ }
+
+ public void ice_exception(Ice.LocalException e)
+ {
+ amiFailure(prefix, "Failed to remove adapter '" + adapterId + "'",
+ e.toString());
+ }
+ };
+
+ try
+ {
+ _coordinator.getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
+ _coordinator.getAdmin().removeAdapter_async(cb, adapterId);
+ }
+ catch(Ice.LocalException e)
+ {
+ failure(prefix, "Failed to remove adapter '" + adapterId + "'", e.toString());
+ }
+ finally
+ {
+ _coordinator.getMainFrame().setCursor(
+ Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
+ }
+ }
+
+
PropertySetDescriptor findNamedPropertySet(String name, String applicationName)
{
ApplicationDescriptor descriptor = (ApplicationDescriptor)
@@ -376,6 +645,16 @@ public class Root extends ListTreeNode
private final java.util.Map _descriptorMap = new java.util.TreeMap();
//
+ // Map AdapterId => AdapterInfo
+ //
+ private java.util.SortedMap _adapters = new java.util.TreeMap();
+
+ //
+ // Map stringified identity => ObjectInfo
+ //
+ private java.util.SortedMap _objects = new java.util.TreeMap();
+
+ //
// 'this' is the root of the tree
//
private final JTree _tree;
@@ -383,5 +662,8 @@ public class Root extends ListTreeNode
private String _label;
+ private ObjectDialog _objectDialog;
+
static private RegistryEditor _editor;
+ static private JPopupMenu _popup;
}
diff --git a/java/src/IceGridGUI/LiveDeployment/Server.java b/java/src/IceGridGUI/LiveDeployment/Server.java
index 1cee5fa83e0..f48c48fdf13 100755
--- a/java/src/IceGridGUI/LiveDeployment/Server.java
+++ b/java/src/IceGridGUI/LiveDeployment/Server.java
@@ -184,8 +184,9 @@ class Server extends ListArrayTreeNode
{
getCoordinator().getMainFrame().setCursor(
Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- getCoordinator().getAdmin().patchServer_async(cb, _id,
- shutdown == JOptionPane.YES_OPTION);
+ getCoordinator().getAdmin().
+ patchServer_async(cb, _id,
+ shutdown == JOptionPane.YES_OPTION);
}
catch(Ice.LocalException e)
{
diff --git a/java/src/IceGridGUI/LiveDeployment/TableField.java b/java/src/IceGridGUI/LiveDeployment/TableField.java
index b89877b668f..4b907bfa9b1 100755
--- a/java/src/IceGridGUI/LiveDeployment/TableField.java
+++ b/java/src/IceGridGUI/LiveDeployment/TableField.java
@@ -36,7 +36,20 @@ public class TableField extends JTable
_columnNames = new java.util.Vector(2);
_columnNames.add(headKey);
_columnNames.add(headValue);
+ init();
+ }
+
+ public TableField(String headKey, String headValue1, String headValue2)
+ {
+ _columnNames = new java.util.Vector(3);
+ _columnNames.add(headKey);
+ _columnNames.add(headValue1);
+ _columnNames.add(headValue2);
+ init();
+ }
+ private void init()
+ {
_model = new DefaultTableModel()
{
public boolean isCellEditable(int row, int column)
@@ -49,7 +62,6 @@ public class TableField extends JTable
setCellSelectionEnabled(false);
setOpaque(false);
setPreferredScrollableViewportSize(getPreferredSize());
-
}
public void setProperties(java.util.List properties, Utils.Resolver resolver)
@@ -80,6 +92,18 @@ public class TableField extends JTable
setSortedMap(map);
}
+ public void setObjects(java.util.SortedMap objects)
+ {
+ java.util.SortedMap map = new java.util.TreeMap();
+ java.util.Iterator p = objects.values().iterator();
+ while(p.hasNext())
+ {
+ ObjectInfo oi = (ObjectInfo)p.next();
+ map.put(oi.proxy.toString(), oi.type);
+ }
+ setSortedMap(map);
+ }
+
public void setEnvs(java.util.List envs, Utils.Resolver resolver)
{
java.util.SortedMap map = new java.util.TreeMap();
@@ -103,6 +127,47 @@ public class TableField extends JTable
setSortedMap(map);
}
+ public void setAdapters(java.util.SortedMap adapters)
+ {
+ java.util.Vector vector = new java.util.Vector(adapters.size());
+ java.util.Iterator p = adapters.entrySet().iterator();
+ while(p.hasNext())
+ {
+ java.util.Vector row = new java.util.Vector(3);
+ java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
+ row.add((String)entry.getKey());
+
+ AdapterInfo ai = (AdapterInfo)entry.getValue();
+
+ if(ai.proxy == null)
+ {
+ row.add("");
+ }
+ else
+ {
+ String str = ai.proxy.toString();
+ int index = str.indexOf(':');
+ if(index == -1 || index == str.length() - 1)
+ {
+ row.add("");
+ }
+ else
+ {
+ row.add(str.substring(index + 1));
+ }
+ }
+
+ row.add(ai.replicaGroupId);
+ vector.add(row);
+ }
+
+ _model.setDataVector(vector, _columnNames);
+
+ DefaultTableCellRenderer cr = (DefaultTableCellRenderer)
+ getDefaultRenderer(String.class);
+ cr.setOpaque(false);
+ }
+
public void setSortedMap(java.util.SortedMap map)
{
diff --git a/java/src/IceGridGUI/LiveDeployment/TreeNode.java b/java/src/IceGridGUI/LiveDeployment/TreeNode.java
index 912f5d0c29f..2c89431a660 100755
--- a/java/src/IceGridGUI/LiveDeployment/TreeNode.java
+++ b/java/src/IceGridGUI/LiveDeployment/TreeNode.java
@@ -40,7 +40,9 @@ public abstract class TreeNode extends TreeNodeBase
public static final int SHUTDOWN_NODE = 4;
public static final int SERVER_INSTALL_DISTRIBUTION = 5;
- static public final int ACTION_COUNT = 6;
+ public static final int ADD_OBJECT = 6;
+
+ static public final int ACTION_COUNT = 7;
public boolean[] getAvailableActions()
{
@@ -71,6 +73,10 @@ public abstract class TreeNode extends TreeNodeBase
{
assert false;
}
+ public void addObject()
+ {
+ assert false;
+ }
//
// Helpers
@@ -129,6 +135,11 @@ public abstract class TreeNode extends TreeNodeBase
amiFailure(prefix, title, "Node '" +
nue.name + "' is unreachable: " + nue.reason);
}
+ else if(e instanceof IceGrid.DeploymentException)
+ {
+ IceGrid.DeploymentException de = (IceGrid.DeploymentException)e;
+ amiFailure(prefix, title, "Deployment exception: " + de.reason);
+ }
else
{
amiFailure(prefix, title, e.toString());
diff --git a/java/src/IceGridGUI/RegistryObserverI.java b/java/src/IceGridGUI/RegistryObserverI.java
index 90440538af5..dfc0c0420f7 100755
--- a/java/src/IceGridGUI/RegistryObserverI.java
+++ b/java/src/IceGridGUI/RegistryObserverI.java
@@ -49,7 +49,7 @@ class RegistryObserverI extends _RegistryObserverDisp
if(_initialized)
{
- _coordinator.registryInit(_serial, _applications);
+ _coordinator.registryInit(_serial, _applications, _adapters, _objects);
}
else
{
@@ -58,12 +58,14 @@ class RegistryObserverI extends _RegistryObserverDisp
}
- public synchronized void init(int serial, java.util.LinkedList applications, AdapterInfo[] adpts,
+ public synchronized void init(int serial, java.util.LinkedList applications, AdapterInfo[] adapters,
ObjectInfo[] objects, Ice.Current current)
{
_initialized = true;
_serial = serial;
_applications = applications;
+ _adapters = adapters;
+ _objects = objects;
notify();
}
@@ -105,26 +107,68 @@ class RegistryObserverI extends _RegistryObserverDisp
public void adapterAdded(final int serial, final AdapterInfo info, Ice.Current current)
{
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ _coordinator.adapterAdded(serial, info);
+ }
+ });
}
public void adapterUpdated(final int serial, final AdapterInfo info, Ice.Current current)
{
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ _coordinator.adapterUpdated(serial, info);
+ }
+ });
}
public void adapterRemoved(final int serial, final String id, Ice.Current current)
{
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ _coordinator.adapterRemoved(serial, id);
+ }
+ });
}
public void objectAdded(final int serial, final ObjectInfo info, Ice.Current current)
{
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ _coordinator.objectAdded(serial, info);
+ }
+ });
}
public void objectUpdated(final int serial, final ObjectInfo info, Ice.Current current)
{
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ _coordinator.objectUpdated(serial, info);
+ }
+ });
}
public void objectRemoved(final int serial, final Ice.Identity id, Ice.Current current)
{
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ _coordinator.objectRemoved(serial, id);
+ }
+ });
}
private Coordinator _coordinator;
@@ -136,4 +180,6 @@ class RegistryObserverI extends _RegistryObserverDisp
//
private int _serial;
private java.util.LinkedList _applications;
+ private AdapterInfo[] _adapters;
+ private ObjectInfo[] _objects;
};