summaryrefslogtreecommitdiff
path: root/java/src/IceGrid/TreeNode/Application.java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2005-10-11 22:07:52 +0000
committerBernard Normier <bernard@zeroc.com>2005-10-11 22:07:52 +0000
commit3498de4cc662bf616f1e9c55fc93a66820555f0f (patch)
treef10979e753877b27e4e8b1fc20ab459e92cf020f /java/src/IceGrid/TreeNode/Application.java
parentAbility to edit/copy applications (diff)
downloadice-3498de4cc662bf616f1e9c55fc93a66820555f0f.tar.bz2
ice-3498de4cc662bf616f1e9c55fc93a66820555f0f.tar.xz
ice-3498de4cc662bf616f1e9c55fc93a66820555f0f.zip
Cleanup + application destruction
Diffstat (limited to 'java/src/IceGrid/TreeNode/Application.java')
-rwxr-xr-xjava/src/IceGrid/TreeNode/Application.java103
1 files changed, 17 insertions, 86 deletions
diff --git a/java/src/IceGrid/TreeNode/Application.java b/java/src/IceGrid/TreeNode/Application.java
index b6b74102d19..a56c29449e4 100755
--- a/java/src/IceGrid/TreeNode/Application.java
+++ b/java/src/IceGrid/TreeNode/Application.java
@@ -218,16 +218,31 @@ public class Application extends EditableParent
}
Root root = (Root)_parent;
- if(_ephemeral)
+ if(_ephemeral || isNew())
{
root.removeChild(this, true);
return true;
}
else if(_model.canUpdate())
{
+ int confirm = JOptionPane.showConfirmDialog(
+ _model.getMainFrame(),
+ "This will immediately remove this application from "
+ + "the IceGrid Registry. Do you want to proceed?",
+ "Remove Confirmation",
+ JOptionPane.YES_NO_OPTION);
+
//
- // TODO: must save immediately!
+ // Asks for confirmation
//
+ if(confirm == JOptionPane.YES_OPTION)
+ {
+ if(_model.removeApplication(_id))
+ {
+ root.removeChild(this, true);
+ return true;
+ }
+ }
}
return false;
}
@@ -269,90 +284,6 @@ public class Application extends EditableParent
_descriptor = descriptor;
}
-
-
- Application(Application o)
- {
- super(o);
-
- _ephemeral = false;
- //
- // We don't deep-copy _descriptor because it's difficult :)
- // So we'll have to be carefull to properly recover the "old" descriptor.
- //
- _descriptor = o._descriptor;
- _origVariables = o._origVariables;
- _origDescription = o._origDescription;
-
- try
- {
- _replicatedAdapters = new ReplicatedAdapters(o._replicatedAdapters);
- addChild(_replicatedAdapters);
-
- _serviceTemplates = new ServiceTemplates(o._serviceTemplates);
- addChild(_serviceTemplates);
-
- _serverTemplates = new ServerTemplates(o._serverTemplates);
- addChild(_serverTemplates);
-
- _nodes = new Nodes(o._nodes);
- addChild(_nodes);
- }
- catch(UpdateFailedException e)
- {
- assert false; // impossible
- }
- }
-
- //
- // Try to apply a major update (the caller must change the descriptor,
- // and restore it if the applyUpdate is unsuccessful
- //
- boolean applyUpdate()
- {
- Application copy = new Application(this);
-
- try
- {
- update();
- }
- catch(UpdateFailedException e)
- {
- JOptionPane.showMessageDialog(
- _model.getMainFrame(),
- e.toString(),
- "Duplicate id error",
- JOptionPane.ERROR_MESSAGE);
-
- _model.getRoot().restore(copy);
- return false;
- }
- return true;
- }
-
- //
- // Major update than can't fail
- //
- void applySafeUpdate()
- {
- try
- {
- update();
- }
- catch(UpdateFailedException e)
- {
- assert false;
- }
- }
-
- void update() throws UpdateFailedException
- {
- _replicatedAdapters.update();
- _serviceTemplates.update();
- _serverTemplates.update();
- _nodes.update();
- }
-
//
// Try to rebuild this application;
// no-op if it fails!