summaryrefslogtreecommitdiff
path: root/java/src/IceBox/ServiceManagerI.java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2007-11-30 15:27:49 -0500
committerBernard Normier <bernard@zeroc.com>2007-11-30 15:27:49 -0500
commite5c6f17ce67f71bacdc4d2a01be487907e08f8cc (patch)
tree1289b3dd8e93fe0e36be8ecdff2f024bb1c57271 /java/src/IceBox/ServiceManagerI.java
parentMerge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff)
downloadice-e5c6f17ce67f71bacdc4d2a01be487907e08f8cc.tar.bz2
ice-e5c6f17ce67f71bacdc4d2a01be487907e08f8cc.tar.xz
ice-e5c6f17ce67f71bacdc4d2a01be487907e08f8cc.zip
Added Properties facet to IceBox services
Diffstat (limited to 'java/src/IceBox/ServiceManagerI.java')
-rw-r--r--java/src/IceBox/ServiceManagerI.java77
1 files changed, 60 insertions, 17 deletions
diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java
index 134425e06b6..471e5aebaac 100644
--- a/java/src/IceBox/ServiceManagerI.java
+++ b/java/src/IceBox/ServiceManagerI.java
@@ -291,7 +291,35 @@ public class ServiceManagerI extends _ServiceManagerDisp
//
_server.shutdownOnInterrupt();
+
+ //
+ // Register "this" as a facet to the Admin object and
+ // create Admin object
//
+ try
+ {
+ _server.communicator().addAdminFacet(this, "IceBox.ServiceManager");
+
+ //
+ // Add a Properties facet for each service
+ //
+ for(ServiceInfo info: _services)
+ {
+ Ice.Communicator communicator = info.communicator != null ? info.communicator : _server.communicator();
+ _server.communicator().addAdminFacet(new PropertiesAdminI(communicator.getProperties()),
+ "IceBox.Service." + info.name + ".Properties");
+ }
+
+ _server.communicator().getAdmin();
+ }
+ catch(Ice.ObjectAdapterDeactivatedException ex)
+ {
+ //
+ // Expected if the communicator has been shutdown.
+ //
+ }
+
+ //
// Start request dispatching after we've started the services.
//
if(adapter != null)
@@ -308,22 +336,6 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
}
- //
- // Register "this" as a facet to the Admin object and
- // create Admin object
- //
- try
- {
- _server.communicator().addAdminFacet(this, "IceBox.ServiceManager");
- _server.communicator().getAdmin();
- }
- catch(Ice.ObjectAdapterDeactivatedException ex)
- {
- //
- // Expected if the communicator has been shutdown.
- //
- }
-
_server.communicator().waitForShutdown();
_server.defaultInterrupt();
@@ -669,6 +681,15 @@ public class ServiceManagerI extends _ServiceManagerDisp
{
try
{
+ _server.communicator().removeAdminFacet("IceBox.Service." + info.name + ".Properties");
+ }
+ catch(Ice.LocalException e)
+ {
+ // Ignored
+ }
+
+ try
+ {
info.communicator.shutdown();
info.communicator.waitForShutdown();
}
@@ -817,7 +838,7 @@ public class ServiceManagerI extends _ServiceManagerDisp
}
}
- class ServiceInfo
+ static class ServiceInfo
{
public String name;
public Service service;
@@ -826,6 +847,28 @@ public class ServiceManagerI extends _ServiceManagerDisp
public String[] args;
}
+ static class PropertiesAdminI extends Ice._PropertiesAdminDisp
+ {
+ PropertiesAdminI(Ice.Properties properties)
+ {
+ _properties = properties;
+ }
+
+ public String
+ getProperty(String name, Ice.Current current)
+ {
+ return _properties.getProperty(name);
+ }
+
+ public java.util.TreeMap
+ getPropertiesForPrefix(String name, Ice.Current current)
+ {
+ return new java.util.TreeMap(_properties.getPropertiesForPrefix(name));
+ }
+
+ private final Ice.Properties _properties;
+ }
+
private Ice.Application _server;
private Ice.Logger _logger;
private String[] _argv; // Filtered server argument vector