diff options
author | Bernard Normier <bernard@zeroc.com> | 2005-09-27 14:57:58 +0000 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2005-09-27 14:57:58 +0000 |
commit | 731b70f3de99ecc9be2137a383d087a0f51c8553 (patch) | |
tree | afa4de6f5748a2609297a65a205107869fbb72ca /java/src/IceGrid/TreeNode/Server.java | |
parent | Fixed bug 495 - assertion on server side udp shutdown (diff) | |
download | ice-731b70f3de99ecc9be2137a383d087a0f51c8553.tar.bz2 ice-731b70f3de99ecc9be2137a383d087a0f51c8553.tar.xz ice-731b70f3de99ecc9be2137a383d087a0f51c8553.zip |
Service templates editing + refactoring
Diffstat (limited to 'java/src/IceGrid/TreeNode/Server.java')
-rwxr-xr-x | java/src/IceGrid/TreeNode/Server.java | 105 |
1 files changed, 63 insertions, 42 deletions
diff --git a/java/src/IceGrid/TreeNode/Server.java b/java/src/IceGrid/TreeNode/Server.java index dc786c8def0..da12f3e3414 100755 --- a/java/src/IceGrid/TreeNode/Server.java +++ b/java/src/IceGrid/TreeNode/Server.java @@ -439,15 +439,9 @@ class Server extends EditableParent Server(boolean brandNew, String serverId,
Utils.Resolver resolver, ServerInstanceDescriptor instanceDescriptor,
ServerDescriptor serverDescriptor,
- Application application) throws DuplicateIdException
+ Application application) throws UpdateFailedException
{
super(brandNew, serverId, application.getModel());
- Ice.IntHolder pid = new Ice.IntHolder();
- _state = application.registerServer(resolver.find("node"),
- _id,
- this,
- pid);
- _pid = pid.value;
rebuild(resolver, instanceDescriptor, serverDescriptor, application);
}
@@ -476,7 +470,7 @@ class Server extends EditableParent void rebuild(Utils.Resolver resolver,
ServerInstanceDescriptor instanceDescriptor,
ServerDescriptor serverDescriptor,
- Application application) throws DuplicateIdException
+ Application application) throws UpdateFailedException
{
assert serverDescriptor != null;
_resolver = resolver;
@@ -487,54 +481,81 @@ class Server extends EditableParent boolean isEditable = (instanceDescriptor == null);
_propertiesHolder = new PropertiesHolder(serverDescriptor);
- if(serverDescriptor instanceof IceBoxDescriptor)
+ try
{
- IceBoxDescriptor iceBoxDescriptor = (IceBoxDescriptor)serverDescriptor;
-
- _services = new Services(iceBoxDescriptor.services,
- isEditable ? this : null, _resolver, application);
- addChild(_services);
- _services.setParent(this);
+ if(serverDescriptor instanceof IceBoxDescriptor)
+ {
+ IceBoxDescriptor iceBoxDescriptor = (IceBoxDescriptor)serverDescriptor;
+
+ _services = new Services(iceBoxDescriptor.services,
+ isEditable, _resolver, application);
+ addChild(_services);
+ //
+ // IceBox has not dbEnv
+ //
+ assert serverDescriptor.dbEnvs.size() == 0;
+ _dbEnvs = null;
+ }
+ else
+ {
+ _services = null;
+ _dbEnvs = new DbEnvs(serverDescriptor.dbEnvs,
+ isEditable, _resolver, _model);
+ addChild(_dbEnvs);
+ }
- //
- // IceBox has not dbEnv
- //
- assert serverDescriptor.dbEnvs.size() == 0;
- _dbEnvs = null;
+ _adapters = new Adapters(serverDescriptor.adapters,
+ isEditable, _services != null,
+ _resolver, _model);
+ addChild(_adapters);
}
- else
+ catch(UpdateFailedException e)
{
- _services = null;
- _dbEnvs = new DbEnvs(serverDescriptor.dbEnvs,
- isEditable, _resolver, _model);
- addChild(_dbEnvs);
- _dbEnvs.setParent(this);
+ e.addParent(this);
+ throw e;
}
+ }
- _adapters = new Adapters(serverDescriptor.adapters,
- isEditable, _services != null,
- _resolver, application, _model);
- addChild(_adapters);
- _adapters.setParent(this);
+
+ public void setParent(CommonBase parent)
+ {
+ Ice.IntHolder pid = new Ice.IntHolder();
+ _state = _model.getRoot().registerServer(_resolver.find("node"),
+ _id,
+ this,
+ pid);
+ _pid = pid.value;
+ super.setParent(parent);
}
- public void unregister()
+ public void clearParent()
{
- getApplication().unregisterServer(_resolver.find("node"),
- _id,
- this);
- _adapters.unregister();
- if(_services != null)
+ if(_parent != null)
{
- _services.unregister();
+ _model.getRoot().unregisterServer(_resolver.find("node"),
+ _id, this);
+ super.clearParent();
}
+
}
- void cascadeDeleteServiceInstance(String templateId)
+ java.util.List findServiceInstances(String template)
+ {
+ if(_services != null)
+ {
+ return _services.findServiceInstances(template);
+ }
+ else
+ {
+ return new java.util.LinkedList();
+ }
+ }
+
+ void removeServiceInstances(String template)
{
if(_services != null)
{
- _services.cascadeDeleteServiceInstance(templateId);
+ _services.removeServiceInstances(template);
}
}
@@ -634,9 +655,9 @@ class Server extends EditableParent public String toString()
{
- if(_instanceDescriptor == null)
+ if(_instanceDescriptor == null || isEphemeral())
{
- return _id;
+ return super.toString();
}
else
{
|