summaryrefslogtreecommitdiff
path: root/java/src/IceGrid/TreeNode/Application.java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2005-06-25 16:48:42 +0000
committerBernard Normier <bernard@zeroc.com>2005-06-25 16:48:42 +0000
commit68c4c2ad068c5647bef41659bb16811374d1fedc (patch)
treefee0b1ea8e3d0f32c53172e8a7e591eba7342db6 /java/src/IceGrid/TreeNode/Application.java
parentAdded minimal client to CE build (diff)
downloadice-68c4c2ad068c5647bef41659bb16811374d1fedc.tar.bz2
ice-68c4c2ad068c5647bef41659bb16811374d1fedc.tar.xz
ice-68c4c2ad068c5647bef41659bb16811374d1fedc.zip
Fixed build
Diffstat (limited to 'java/src/IceGrid/TreeNode/Application.java')
-rwxr-xr-xjava/src/IceGrid/TreeNode/Application.java92
1 files changed, 64 insertions, 28 deletions
diff --git a/java/src/IceGrid/TreeNode/Application.java b/java/src/IceGrid/TreeNode/Application.java
index 84ee0c1f9f5..00fa0b3e397 100755
--- a/java/src/IceGrid/TreeNode/Application.java
+++ b/java/src/IceGrid/TreeNode/Application.java
@@ -9,57 +9,93 @@
package IceGrid.TreeNode;
import IceGrid.ApplicationDescriptor;
+import IceGrid.ApplicationUpdateDescriptor;
class Application extends Parent
{
//
// Builds the application and all its subtrees
//
- Application(ApplicationDescriptor descriptor, NodeViewRoot nodeViewRoot)
+ Application(ApplicationDescriptor descriptor, NodeViewRoot nodeViewRoot,
+ boolean fireEvent)
{
- _nodeViewRoot = nodeViewRoot;
- update(descriptor, false);
- }
+ super(descriptor.name);
- void update(ApplicationDescriptor newDescriptor, boolean fireEvent)
- {
- assert(newDescriptor != null);
- clearChildren();
-
- _descriptor = newDescriptor;
+ _descriptor = descriptor;
+ _nodeViewRoot = nodeViewRoot;
- _serverTemplates = new ServerTemplates(_descriptor.serverTemplates, _descriptor.serviceTemplates);
+ _serverTemplates = new ServerTemplates(_descriptor.serverTemplates);
addChild(_serverTemplates);
- _serverTemplates.addParent(this); // no-op when this is not yet attached to its root
- // (i.e. during construction)
_serviceTemplates = new ServiceTemplates(_descriptor.serviceTemplates);
addChild(_serviceTemplates);
- _serviceTemplates.addParent(this);
_nodeVars = new NodeVars(_descriptor.nodes);
addChild(_nodeVars);
- _nodeVars.addParent(this);
-
+
_serverInstances = new ServerInstances(_descriptor.servers,
- _descriptor.serverTemplates,
- _descriptor.serviceTemplates,
- _nodeViewRoot);
+ _nodeViewRoot,
+ fireEvent);
addChild(_serverInstances);
- _serverInstances.addParent(this);
+ }
- if(fireEvent)
+ void update(ApplicationUpdateDescriptor desc)
+ {
+ //
+ // Variables
+ //
+ for(int i = 0; i < desc.removeVariables.length; ++i)
{
- // fireStructureChanged(this);
+ _descriptor.variables.remove(desc.removeVariables[i]);
}
- }
-
- public String toString()
- {
- return _descriptor.name;
+ _descriptor.variables.putAll(desc.variables);
+
+ //
+ // TODO: comment
+ //
+
+
+ //
+ // Server templates
+ //
+ for(int i = 0; i < desc.removeServerTemplates.length; ++i)
+ {
+ _descriptor.serverTemplates.remove(desc.removeServerTemplates[i]);
+ }
+ _descriptor.serverTemplates.putAll(desc.serverTemplates);
+ _serverTemplates.update(desc.serverTemplates, desc.removeServerTemplates);
+
+ //
+ // Service templates
+ //
+ for(int i = 0; i < desc.removeServiceTemplates.length; ++i)
+ {
+ _descriptor.serviceTemplates.remove(desc.removeServiceTemplates[i]);
+ }
+ _descriptor.serviceTemplates.putAll(desc.serviceTemplates);
+ _serviceTemplates.update(desc.serviceTemplates, desc.removeServiceTemplates);
+
+ //
+ // Nodes
+ //
+ for(int i = 0; i < desc.removeNodes.length; ++i)
+ {
+ _descriptor.nodes.remove(desc.removeNodes[i]);
+ }
+ _descriptor.nodes.addAll(desc.nodes);
+ _nodeVars.update(desc.nodes, desc.removeNodes);
+
+ //
+ // Servers
+ //
+ for(int i = 0; i < desc.removeServers.length; ++i)
+ {
+ _descriptor.servers.remove(desc.removeServers[i]);
+ }
+ _descriptor.servers.addAll(desc.servers);
+ _serverInstances.update(desc.servers, desc.removeServers);
}
-
private ApplicationDescriptor _descriptor;
private NodeViewRoot _nodeViewRoot;