From 4df583f8e4785296e4c4b592d24bba5f1fd02136 Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Wed, 31 May 2006 22:52:08 +0000 Subject: Fixed various bugs --- java/src/IceGridGUI/Application/AdapterEditor.java | 10 +- java/src/IceGridGUI/Application/Communicator.java | 160 ++++----------------- java/src/IceGridGUI/Application/PlainServer.java | 7 - java/src/IceGridGUI/Application/PlainService.java | 22 --- java/src/IceGridGUI/Application/Root.java | 1 + .../src/IceGridGUI/Application/ServerTemplate.java | 9 +- .../IceGridGUI/Application/ServiceTemplate.java | 9 +- java/src/IceGridGUI/Application/Templates.java | 2 +- java/src/IceGridGUI/ApplicationPane.java | 28 ++-- java/src/IceGridGUI/LiveDeploymentPane.java | 26 ++-- 10 files changed, 77 insertions(+), 197 deletions(-) (limited to 'java/src') diff --git a/java/src/IceGridGUI/Application/AdapterEditor.java b/java/src/IceGridGUI/Application/AdapterEditor.java index 94d7c02c112..d26ff266c89 100755 --- a/java/src/IceGridGUI/Application/AdapterEditor.java +++ b/java/src/IceGridGUI/Application/AdapterEditor.java @@ -439,8 +439,14 @@ class AdapterEditor extends CommunicatorChildEditor _replicaGroupId.setEnabled(isEditable); _replicaGroupId.setEditable(isEditable); - _endpoints.setText( - Utils.substitute(adapter.getProperty("Endpoints"), resolver)); + if(adapter.isEphemeral()) + { + _endpoints.setText("default"); + } + else + { + _endpoints.setText(Utils.substitute(adapter.getProperty("Endpoints"), resolver)); + } _endpoints.setEditable(isEditable); _publishedEndpoints.setEnabled(true); diff --git a/java/src/IceGridGUI/Application/Communicator.java b/java/src/IceGridGUI/Application/Communicator.java index 59a29fbf81d..e8d85b1b6d6 100755 --- a/java/src/IceGridGUI/Application/Communicator.java +++ b/java/src/IceGridGUI/Application/Communicator.java @@ -183,12 +183,15 @@ abstract class Communicator extends TreeNode implements DescriptorHolder abstract Editable getEnclosingEditable(); // - // Returns all instances of 'this'. When 'this' is a template, - // includeTemplate determines whether the template itself is or is not - // included in the list. Otherwise, the list contain 'this' instance - // in any number of enclosing instances ... often simply 'this'. + // When 'this' is a template, returns all instances of this template. + // Otherwise, return just 'this' // - abstract java.util.List findInstances(boolean includeTemplate); + java.util.List findInstances() + { + java.util.List result = new java.util.LinkedList(); + result.add(this); + return result; + } TreeNode findChildLike(TreeNode other) @@ -224,7 +227,6 @@ abstract class Communicator extends TreeNode implements DescriptorHolder abstract class ChildList { abstract TreeNode createChild(Object descriptor) throws UpdateFailedException; - abstract ChildList getMyChildList(Communicator communicator); abstract void newChild(); protected ChildList(boolean sorted) @@ -386,15 +388,7 @@ abstract class Communicator extends TreeNode implements DescriptorHolder removeDescriptor(descriptor); getEnclosingEditable().markModified(); getRoot().updated(); - - java.util.List list = findInstances(true); - java.util.Iterator p = list.iterator(); - while(p.hasNext()) - { - Communicator communicator = (Communicator)p.next(); - ChildList container = getMyChildList(communicator); - container.removeChild(container.findChildWithDescriptor(descriptor)); - } + removeChild(child); } } @@ -453,36 +447,14 @@ abstract class Communicator extends TreeNode implements DescriptorHolder void tryAdd(Object descriptor) throws UpdateFailedException { addDescriptor(descriptor); - - java.util.List newChildren = new java.util.LinkedList(); - java.util.List list = findInstances(true); - - java.util.Iterator p = list.iterator(); - while(p.hasNext()) + try { - Communicator communicator = (Communicator)p.next(); - ChildList container = getMyChildList(communicator); - - try - { - newChildren.add(container.addNewChild(descriptor)); - } - catch(UpdateFailedException e) - { - // - // Rollback - // - java.util.Iterator q = newChildren.iterator(); - p = list.iterator(); - while(q.hasNext()) - { - communicator = (Communicator)p.next(); - container = getMyChildList(communicator); - container.removeChild((TreeNode)q.next()); - } - removeDescriptor(descriptor); - throw e; - } + addNewChild(descriptor); + } + catch(UpdateFailedException e) + { + removeDescriptor(descriptor); + throw e; } getEnclosingEditable().markModified(); } @@ -494,52 +466,16 @@ abstract class Communicator extends TreeNode implements DescriptorHolder // assert _sorted; - java.util.List list = findInstances(true); Object descriptor = child.getDescriptor(); - - java.util.List children = new java.util.Vector(); - - java.util.Iterator p = list.iterator(); - while(p.hasNext()) + removeChild(child); + try { - Communicator communicator = (Communicator)p.next(); - ChildList container = getMyChildList(communicator); - - try - { - child = container.findChildWithDescriptor(descriptor); - removeChild(child); - try - { - container.addNewChild(descriptor); - } - catch(UpdateFailedException e) - { - addChild(child, true); - throw e; - } - children.add(child); - } - catch(UpdateFailedException e) - { - for(int i = children.size() - 1; i >= 0; --i) - { - communicator = (Communicator)list.get(i); - container = getMyChildList(communicator); - child = (TreeNode)children.get(i); - TreeNode badChild = container.findChildWithDescriptor(descriptor); - container.removeChild(badChild); - try - { - container.addChild(child, true); - } - catch(UpdateFailedException ufe) - { - assert false; // impossible - } - } - throw e; - } + addNewChild(descriptor); + } + catch(UpdateFailedException e) + { + addChild(child, true); + throw e; } getEnclosingEditable().markModified(); } @@ -589,11 +525,6 @@ abstract class Communicator extends TreeNode implements DescriptorHolder return new Adapter(Communicator.this, name, ad, false); } - ChildList getMyChildList(Communicator communicator) - { - return communicator.getAdapters(); - } - private void newAdapter(AdapterDescriptor descriptor) { descriptor.name = makeNewChildId(descriptor.name); @@ -635,11 +566,6 @@ abstract class Communicator extends TreeNode implements DescriptorHolder String name = Utils.substitute(dd.name, getResolver()); return new DbEnv(Communicator.this, name, dd, false); } - - ChildList getMyChildList(Communicator communicator) - { - return communicator.getDbEnvs(); - } private void newDbEnv(DbEnvDescriptor descriptor) { @@ -794,43 +720,15 @@ abstract class Communicator extends TreeNode implements DescriptorHolder // trigger an UpdateFailedException // Object descriptor = child.getDescriptor(); - - java.util.List list = findInstances(true); - java.util.List children = new java.util.Vector(); int listIndex = _children.indexOf(child); assert listIndex != -1; - - java.util.Iterator p = list.iterator(); - while(p.hasNext()) - { - Communicator communicator = (Communicator)p.next(); - ChildList container = getMyChildList(communicator); - - try - { - TreeNode newChild = container.createChild(descriptor); - children.add(container._children.set(listIndex, newChild)); - getRoot().getTreeModel().nodeChanged(newChild); - } - catch(UpdateFailedException e) - { - for(int i = children.size() - 1; i >= 0; --i) - { - communicator = (Communicator)list.get(i); - container = getMyChildList(communicator); - container._children.set(listIndex, children.get(i)); - getRoot().getTreeModel().nodeChanged(child); - } - throw e; - } - } + + TreeNode newChild = createChild(descriptor); + _children.set(listIndex, newChild); + getRoot().getTreeModel().nodeChanged(newChild); + getEnclosingEditable().markModified(); } - - ChildList getMyChildList(Communicator communicator) - { - return communicator.getServices(); - } private void newService(ServiceInstanceDescriptor descriptor) { diff --git a/java/src/IceGridGUI/Application/PlainServer.java b/java/src/IceGridGUI/Application/PlainServer.java index 45a65211730..54ac34c71bb 100755 --- a/java/src/IceGridGUI/Application/PlainServer.java +++ b/java/src/IceGridGUI/Application/PlainServer.java @@ -529,13 +529,6 @@ class PlainServer extends Communicator implements Server return _editable; } - java.util.List findInstances(boolean includeTemplate) - { - java.util.List result = new java.util.LinkedList(); - result.add(this); - return result; - } - public boolean isEphemeral() { return _ephemeral; diff --git a/java/src/IceGridGUI/Application/PlainService.java b/java/src/IceGridGUI/Application/PlainService.java index 67734554064..1b417427d47 100755 --- a/java/src/IceGridGUI/Application/PlainService.java +++ b/java/src/IceGridGUI/Application/PlainService.java @@ -171,28 +171,6 @@ class PlainService extends Communicator implements Service, Cloneable ((Communicator)_parent).getServices().move(this, up); } - - java.util.List findInstances(boolean includeTemplate) - { - java.util.List result = new java.util.LinkedList(); - - // - // First find all instances of the enclosing Communicator, including - // the ServerTemplate itself (if that's my parent) - // - java.util.List communicatorList = ((Communicator)_parent).findInstances(true); - - java.util.Iterator p = communicatorList.iterator(); - while(p.hasNext()) - { - Services services = ((Communicator)p.next()).getServices(); - Service service = (Service)services.findChildWithDescriptor(_descriptor); - assert service != null; - result.add(service); - } - return result; - } - public Object rebuild(java.util.List editables) throws UpdateFailedException { diff --git a/java/src/IceGridGUI/Application/Root.java b/java/src/IceGridGUI/Application/Root.java index 2273a1ae4e7..191118c1662 100755 --- a/java/src/IceGridGUI/Application/Root.java +++ b/java/src/IceGridGUI/Application/Root.java @@ -442,6 +442,7 @@ public class Root extends ListTreeNode if(isSelected()) { _coordinator.getSaveAction().setEnabled(false); + _coordinator.getSaveToRegistryAction().setEnabled(false); _coordinator.getDiscardUpdatesAction().setEnabled(false); } } diff --git a/java/src/IceGridGUI/Application/ServerTemplate.java b/java/src/IceGridGUI/Application/ServerTemplate.java index eb60181035e..c2d01a2da6f 100755 --- a/java/src/IceGridGUI/Application/ServerTemplate.java +++ b/java/src/IceGridGUI/Application/ServerTemplate.java @@ -340,14 +340,9 @@ class ServerTemplate extends Communicator return _editable; } - java.util.List findInstances(boolean includeTemplate) + java.util.List findInstances() { - java.util.List result = getRoot().findServerInstances(_id); - if(includeTemplate) - { - result.add(0, this); - } - return result; + return getRoot().findServerInstances(_id); } private TemplateDescriptor _templateDescriptor; diff --git a/java/src/IceGridGUI/Application/ServiceTemplate.java b/java/src/IceGridGUI/Application/ServiceTemplate.java index 7aa5b927f1e..c88d20bd3bc 100755 --- a/java/src/IceGridGUI/Application/ServiceTemplate.java +++ b/java/src/IceGridGUI/Application/ServiceTemplate.java @@ -209,14 +209,9 @@ class ServiceTemplate extends Communicator } } - java.util.List findInstances(boolean includeTemplate) + java.util.List findInstances() { - java.util.List result = getRoot().findServiceInstances(_id); - if(includeTemplate) - { - result.add(0, this); - } - return result; + return getRoot().findServiceInstances(_id); } Editable getEditable() diff --git a/java/src/IceGridGUI/Application/Templates.java b/java/src/IceGridGUI/Application/Templates.java index bc46e063eb0..48f7905aeef 100755 --- a/java/src/IceGridGUI/Application/Templates.java +++ b/java/src/IceGridGUI/Application/Templates.java @@ -26,7 +26,7 @@ abstract class Templates extends ListTreeNode void tryUpdate(Communicator child) throws UpdateFailedException { - java.util.List instanceList = child.findInstances(false); + java.util.List instanceList = child.findInstances(); java.util.List backupList = new java.util.Vector(); java.util.List editables = new java.util.LinkedList(); diff --git a/java/src/IceGridGUI/ApplicationPane.java b/java/src/IceGridGUI/ApplicationPane.java index 3ef7710ab51..0b0abc2e540 100755 --- a/java/src/IceGridGUI/ApplicationPane.java +++ b/java/src/IceGridGUI/ApplicationPane.java @@ -70,6 +70,23 @@ public class ApplicationPane extends JSplitPane implements Tab c.showActions(_currentNode); } + public void refresh() + { + _root.cancelEdit(); + + if(_currentNode != null) + { + _currentEditor = _currentNode.getEditor(); + if(_root.getCoordinator().getCurrentTab() == this) + { + // + // Refresh actions as well + // + _root.getCoordinator().showActions(_currentNode); + } + } + } + public void showNode(TreeNodeBase node) { TreeNode newNode = (TreeNode)node; @@ -111,17 +128,6 @@ public class ApplicationPane extends JSplitPane implements Tab } } - public void refresh() - { - _root.cancelEdit(); - - if(_currentNode != null) - { - _root.getCoordinator().showActions(_currentNode); - _currentEditor = _currentNode.getEditor(); - } - } - public void back() { TreeNode previousNode = null; diff --git a/java/src/IceGridGUI/LiveDeploymentPane.java b/java/src/IceGridGUI/LiveDeploymentPane.java index 69483d07be6..b899feb0de3 100755 --- a/java/src/IceGridGUI/LiveDeploymentPane.java +++ b/java/src/IceGridGUI/LiveDeploymentPane.java @@ -59,6 +59,23 @@ public class LiveDeploymentPane extends JSplitPane implements Tab c.showActions(_currentNode); } + public void refresh() + { + if(_currentNode != null) + { + _currentNode.getEditor(); + + if(_root.getCoordinator().getCurrentTab() == this) + { + // + // Refresh actions as well + // + _root.getCoordinator().showActions(_currentNode); + } + } + } + + public void showNode(TreeNodeBase node) { TreeNode newNode = (TreeNode)node; @@ -94,15 +111,6 @@ public class LiveDeploymentPane extends JSplitPane implements Tab } - public void refresh() - { - if(_currentNode != null) - { - _root.getCoordinator().showActions(_currentNode); - _currentNode.getEditor(); - } - } - public void back() { TreeNode previousNode = null; -- cgit v1.2.3