summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/CHANGES3
-rw-r--r--cpp/doc/Properties.sgml19
-rw-r--r--cpp/src/Ice/PropertiesI.cpp1
-rw-r--r--cpp/src/IceBox/ServiceManagerI.cpp114
-rw-r--r--cpp/src/IceBox/ServiceManagerI.h1
-rw-r--r--java/CHANGES3
-rw-r--r--java/src/Ice/PropertiesI.java1
-rw-r--r--java/src/IceBox/ServiceManagerI.java76
8 files changed, 163 insertions, 55 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index d100fb03bb0..357a30ac841 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -1,6 +1,9 @@
Changes since version 1.2.0
---------------------------
+- Added the IceBox.LoadOrder property, which specifies the order
+ in which IceBox services are loaded.
+
- Added support for the Intel C++ compiler (v8.0) on Linux x86
- Removed the Ice.Daemon, Ice.DaemonNoChdir and Ice.DaemonNoClose
diff --git a/cpp/doc/Properties.sgml b/cpp/doc/Properties.sgml
index f8d4b024e0f..1ac37ffa3e4 100644
--- a/cpp/doc/Properties.sgml
+++ b/cpp/doc/Properties.sgml
@@ -1297,6 +1297,25 @@ are ready to be used.
</section>
</section>
+<section><title>IceBox.LoadOrder</title>
+<section><title>Synopsis</title>
+<synopsis>
+IceBox.LoadOrder=<replaceable>names</replaceable>
+</synopsis>
+</section>
+<section>
+<title>Description</title>
+<para>
+Determines the order in which services are loaded. The service manager
+loads the services in the order they appear in
+<replaceable>names</replaceable>, where each service name is separated
+by a comma or whitespace. Any services not mentioned in
+<replaceable>names</replaceable> are loaded afterward, in an undefined
+order.
+</para>
+</section>
+</section>
+
<section><title>IceBox.Service.<replaceable>name</replaceable></title>
<section><title>Synopsis</title>
<synopsis>
diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp
index 79749f3bdb1..af9500ccfd1 100644
--- a/cpp/src/Ice/PropertiesI.cpp
+++ b/cpp/src/Ice/PropertiesI.cpp
@@ -150,6 +150,7 @@ static const string iceProps[] =
static const string iceBoxProps[] =
{
"DBEnvName.*",
+ "LoadOrder",
"PrintServicesReady",
"Service.*",
"ServiceManager.AdapterId",
diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp
index 2d958c959c5..afe09839c46 100644
--- a/cpp/src/IceBox/ServiceManagerI.cpp
+++ b/cpp/src/IceBox/ServiceManagerI.cpp
@@ -69,52 +69,58 @@ IceBox::ServiceManagerI::run()
adapter->add(obj, stringToIdentity(identity));
//
+ // Parse the IceBox.LoadOrder property.
+ //
+ string order = properties->getProperty("IceBox.LoadOrder");
+ StringSeq loadOrder;
+ if(!order.empty())
+ {
+ string::size_type beg = order.find_first_not_of(",\t ");
+ while(beg != string::npos)
+ {
+ string::size_type end = order.find_first_of(",\t ", beg);
+ if(end == string::npos)
+ {
+ loadOrder.push_back(order.substr(beg));
+ beg = end;
+ }
+ else
+ {
+ loadOrder.push_back(order.substr(beg, end - beg));
+ beg = order.find_first_not_of(",\t ", end);
+ }
+ }
+ }
+
+ //
// Load and start the services defined in the property set
// with the prefix "IceBox.Service.". These properties should
// have the following format:
//
// IceBox.Service.Foo=entry_point [args]
//
+ // We load the services specified in IceBox.LoadOrder first,
+ // then load any remaining services.
+ //
const string prefix = "IceBox.Service.";
-
PropertyDict services = properties->getPropertiesForPrefix(prefix);
- PropertyDict::const_iterator p;
- for(p = services.begin(); p != services.end(); ++p)
- {
- string name = p->first.substr(prefix.size());
- const string& value = p->second;
-
- //
- // Separate the entry point from the arguments.
- //
- string entryPoint;
- StringSeq args;
- string::size_type pos = value.find_first_of(" \t\n");
- if(pos == string::npos)
- {
- entryPoint = value;
- }
- else
+ PropertyDict::iterator p;
+ for(StringSeq::const_iterator q = loadOrder.begin(); q != loadOrder.end(); ++q)
+ {
+ p = services.find(prefix + *q);
+ if(p == services.end())
{
- entryPoint = value.substr(0, pos);
- string::size_type beg = value.find_first_not_of(" \t\n", pos);
- while(beg != string::npos)
- {
- string::size_type end = value.find_first_of(" \t\n", beg);
- if(end == string::npos)
- {
- args.push_back(value.substr(beg));
- beg = end;
- }
- else
- {
- args.push_back(value.substr(beg, end - beg));
- beg = value.find_first_not_of(" \t\n", end);
- }
- }
+ FailureException ex(__FILE__, __LINE__);
+ ex.reason = "ServiceManager: no service definition for `" + *q + "'";
+ throw ex;
}
-
- start(name, entryPoint, args);
+ load(*q, p->second);
+ services.erase(p);
+ }
+ for(p = services.begin(); p != services.end(); ++p)
+ {
+ string name = p->first.substr(prefix.size());
+ load(name, p->second);
}
//
@@ -181,6 +187,42 @@ IceBox::ServiceManagerI::run()
}
void
+IceBox::ServiceManagerI::load(const string& name, const string& value)
+{
+ //
+ // Separate the entry point from the arguments.
+ //
+ string entryPoint;
+ StringSeq args;
+ string::size_type pos = value.find_first_of(" \t\n");
+ if(pos == string::npos)
+ {
+ entryPoint = value;
+ }
+ else
+ {
+ entryPoint = value.substr(0, pos);
+ string::size_type beg = value.find_first_not_of(" \t\n", pos);
+ while(beg != string::npos)
+ {
+ string::size_type end = value.find_first_of(" \t\n", beg);
+ if(end == string::npos)
+ {
+ args.push_back(value.substr(beg));
+ beg = end;
+ }
+ else
+ {
+ args.push_back(value.substr(beg, end - beg));
+ beg = value.find_first_not_of(" \t\n", end);
+ }
+ }
+ }
+
+ start(name, entryPoint, args);
+}
+
+void
IceBox::ServiceManagerI::start(const string& service, const string& entryPoint, const StringSeq& args)
{
//
diff --git a/cpp/src/IceBox/ServiceManagerI.h b/cpp/src/IceBox/ServiceManagerI.h
index 791ca9fd985..d3add45a099 100644
--- a/cpp/src/IceBox/ServiceManagerI.h
+++ b/cpp/src/IceBox/ServiceManagerI.h
@@ -46,6 +46,7 @@ public:
private:
+ void load(const std::string&, const std::string&);
void start(const std::string&, const std::string&, const ::Ice::StringSeq&);
void stopAll();
diff --git a/java/CHANGES b/java/CHANGES
index 410810dcd08..0a7991c2103 100644
--- a/java/CHANGES
+++ b/java/CHANGES
@@ -1,6 +1,9 @@
Changes since version 1.2.0
---------------------------
+- Added the IceBox.LoadOrder property, which specifies the order
+ in which IceBox services are loaded.
+
- Added support for Berkeley DB 4.2.52.
- The default thread pool size is now just one thread. This is the
diff --git a/java/src/Ice/PropertiesI.java b/java/src/Ice/PropertiesI.java
index d050ca4fb7c..b2f799ac5c9 100644
--- a/java/src/Ice/PropertiesI.java
+++ b/java/src/Ice/PropertiesI.java
@@ -433,6 +433,7 @@ final class PropertiesI extends LocalObjectImpl implements Properties
private static final String _iceBoxProps[] =
{
"DBEnvName.*",
+ "LoadOrder",
"PrintServicesReady",
"Service.*",
"ServiceManager.AdapterId",
diff --git a/java/src/IceBox/ServiceManagerI.java b/java/src/IceBox/ServiceManagerI.java
index bfbf2f31ca7..503b6421b64 100644
--- a/java/src/IceBox/ServiceManagerI.java
+++ b/java/src/IceBox/ServiceManagerI.java
@@ -48,39 +48,53 @@ public final class ServiceManagerI extends _ServiceManagerDisp
adapter.add(this, Ice.Util.stringToIdentity(identity));
//
+ // Parse the IceBox.LoadOrder property.
+ //
+ String order = properties.getProperty("IceBox.LoadOrder");
+ String[] loadOrder = null;
+ if(order.length() > 0)
+ {
+ loadOrder = order.trim().split("[,\t ]+");
+ }
+
+ //
// Load and start the services defined in the property set
// with the prefix "IceBox.Service.". These properties should
// have the following format:
//
// IceBox.Service.Foo=Package.Foo [args]
//
+ // We load the services specified in IceBox.LoadOrder first,
+ // then load any remaining services.
+ //
final String prefix = "IceBox.Service.";
java.util.Map services = properties.getPropertiesForPrefix(prefix);
+ if(loadOrder != null)
+ {
+ for(int i = 0; i < loadOrder.length; ++i)
+ {
+ if(loadOrder[i].length() > 0)
+ {
+ String key = prefix + loadOrder[i];
+ String value = (String)services.get(key);
+ if(value == null)
+ {
+ FailureException ex = new FailureException();
+ ex.reason = "ServiceManager: no service definition for `" + loadOrder[i] + "'";
+ throw ex;
+ }
+ load(loadOrder[i], value);
+ services.remove(key);
+ }
+ }
+ }
java.util.Iterator p = services.entrySet().iterator();
while(p.hasNext())
{
java.util.Map.Entry entry = (java.util.Map.Entry)p.next();
String name = ((String)entry.getKey()).substring(prefix.length());
String value = (String)entry.getValue();
-
- //
- // Separate the entry point from the arguments.
- //
- String className;
- String[] args;
- int pos = IceInternal.StringUtil.findFirstOf(value, " \t\n");
- if(pos == -1)
- {
- className = value;
- args = new String[0];
- }
- else
- {
- className = value.substring(0, pos);
- args = value.substring(pos).trim().split("[ \t\n]+", pos);
- }
-
- start(name, className, args);
+ load(name, value);
}
//
@@ -167,6 +181,30 @@ public final class ServiceManagerI extends _ServiceManagerDisp
}
private void
+ load(String name, String value)
+ throws FailureException
+ {
+ //
+ // Separate the entry point from the arguments.
+ //
+ String className;
+ String[] args;
+ int pos = IceInternal.StringUtil.findFirstOf(value, " \t\n");
+ if(pos == -1)
+ {
+ className = value;
+ args = new String[0];
+ }
+ else
+ {
+ className = value.substring(0, pos);
+ args = value.substring(pos).trim().split("[ \t\n]+", pos);
+ }
+
+ start(name, className, args);
+ }
+
+ private void
start(String service, String className, String[] args)
throws FailureException
{