summaryrefslogtreecommitdiff
path: root/cpp/src/Ice
diff options
context:
space:
mode:
authorDwayne Boone <dwayne@zeroc.com>2006-12-18 17:06:44 +0000
committerDwayne Boone <dwayne@zeroc.com>2006-12-18 17:06:44 +0000
commitd07fdae285690f699a70f97f36232e516dcad2bc (patch)
treec239def689c5e6cc53ac76dbe3e60ec11c306964 /cpp/src/Ice
parentFixed tryLock() comment (diff)
downloadice-d07fdae285690f699a70f97f36232e516dcad2bc.tar.bz2
ice-d07fdae285690f699a70f97f36232e516dcad2bc.tar.xz
ice-d07fdae285690f699a70f97f36232e516dcad2bc.zip
Object adapter properties now prefixed by "Ice.OA."
Diffstat (limited to 'cpp/src/Ice')
-rw-r--r--cpp/src/Ice/CommunicatorI.cpp2
-rw-r--r--cpp/src/Ice/ObjectAdapterFactory.cpp2
-rw-r--r--cpp/src/Ice/ObjectAdapterI.cpp124
-rw-r--r--cpp/src/Ice/ObjectAdapterI.h4
-rw-r--r--cpp/src/Ice/PropertyNames.cpp27
-rw-r--r--cpp/src/Ice/PropertyNames.h2
6 files changed, 131 insertions, 30 deletions
diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp
index 913df832639..d56d618eaa8 100644
--- a/cpp/src/Ice/CommunicatorI.cpp
+++ b/cpp/src/Ice/CommunicatorI.cpp
@@ -152,7 +152,7 @@ Ice::CommunicatorI::identityToString(const Identity& ident) const
ObjectAdapterPtr
Ice::CommunicatorI::createObjectAdapter(const string& name)
{
- return createObjectAdapterWithEndpoints(name, getProperties()->getProperty(name + ".Endpoints"));
+ return _instance->objectAdapterFactory()->createObjectAdapter(name, "", 0);
}
ObjectAdapterPtr
diff --git a/cpp/src/Ice/ObjectAdapterFactory.cpp b/cpp/src/Ice/ObjectAdapterFactory.cpp
index 36b88ee695e..03ca3d518c5 100644
--- a/cpp/src/Ice/ObjectAdapterFactory.cpp
+++ b/cpp/src/Ice/ObjectAdapterFactory.cpp
@@ -117,7 +117,7 @@ IceInternal::ObjectAdapterFactory::createObjectAdapter(const string& name, const
throw AlreadyRegisteredException(__FILE__, __LINE__, "object adapter", name);
}
- if(name.empty() && (!name.empty() || router != 0))
+ if(name.empty() && (!endpoints.empty() || router != 0))
{
InitializationException ex(__FILE__, __LINE__);
ex.reason = "Cannot configure endpoints or router with nameless object adapter";
diff --git a/cpp/src/Ice/ObjectAdapterI.cpp b/cpp/src/Ice/ObjectAdapterI.cpp
index ac6d5262c2a..954e3976ad5 100644
--- a/cpp/src/Ice/ObjectAdapterI.cpp
+++ b/cpp/src/Ice/ObjectAdapterI.cpp
@@ -45,6 +45,8 @@ using namespace std;
using namespace Ice;
using namespace IceInternal;
+string Ice::ObjectAdapterI::_propertyPrefix = "Ice.OA.";
+
string
Ice::ObjectAdapterI::getName() const
{
@@ -99,10 +101,13 @@ Ice::ObjectAdapterI::activate()
locatorInfo = _locatorInfo;
if(!_noConfig)
{
- printAdapterReady =
- _instance->initializationData().properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0;
- registerProcess =
- _instance->initializationData().properties->getPropertyAsInt(_name + ".RegisterProcess") > 0;
+ PropertiesPtr properties = _instance->initializationData().properties;
+ printAdapterReady = properties->getPropertyAsInt("Ice.PrintAdapterReady") > 0;
+ //
+ // DEPREACTED PROPERTY: Remove extra code in future release
+ //
+ registerProcess = properties->getPropertyAsIntWithDefault(_propertyPrefix + _name + ".RegisterProcess",
+ properties->getPropertyAsInt(_name + ".RegisterProcess")) > 0;
}
}
@@ -695,12 +700,18 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
}
//
+ // DEPRECATED PROPERTIES: Remove extra code in future release
+ //
+
+ //
// Make sure named adapter has some configuration
//
+ PropertiesPtr properties = instance->initializationData().properties;
+ StringSeq oldProps = filterProperties(_name + ".");
if(endpointInfo.empty() && router == 0)
{
- PropertyDict oaProps = instance->initializationData().properties->getPropertiesForPrefix(_name + ".");
- if(oaProps.size() == 0)
+ StringSeq props = filterProperties(_propertyPrefix + _name + ".");
+ if(oldProps.size() == 0 && props.size() == 0)
{
InitializationException ex(__FILE__, __LINE__);
ex.reason = "Object adapter \"" + _name + "\" requires configuration.";
@@ -708,17 +719,34 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
}
}
- const_cast<string&>(_id) = instance->initializationData().properties->getProperty(name + ".AdapterId");
- const_cast<string&>(_replicaGroupId) =
- instance->initializationData().properties->getProperty(name + ".ReplicaGroupId");
+ if(oldProps.size() != 0)
+ {
+ Warning out(_instance->initializationData().logger);
+ out << "The following properties have been deprecated, please prepend \"Ice.OA.\":";
+ for(unsigned int i = 0; i < oldProps.size(); ++i)
+ {
+ out << "\n " << oldProps[i];
+ }
+ }
+
+ const_cast<string&>(_id) = properties->getPropertyWithDefault(_propertyPrefix + _name + ".AdapterId",
+ properties->getProperty(_name + ".AdapterId"));
+ const_cast<string&>(_replicaGroupId) =
+ properties->getPropertyWithDefault(_propertyPrefix + _name + ".ReplicaGroupId",
+ properties->getProperty(_name + ".ReplicaGroupId"));
__setNoDelete(true);
try
{
if(!router)
{
- const_cast<RouterPrx&>(router) =
- RouterPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(_name + ".Router"));
+ const_cast<RouterPrx&>(router) = RouterPrx::uncheckedCast(
+ _instance->proxyFactory()->propertyToProxy(_propertyPrefix + _name + ".Router"));
+ if(!router)
+ {
+ const_cast<RouterPrx&>(router) = RouterPrx::uncheckedCast(
+ _instance->proxyFactory()->propertyToProxy(_name + ".Router"));
+ }
}
if(router)
{
@@ -767,7 +795,16 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
// The connection factory might change it, for example, to
// fill in the real port number.
//
- vector<EndpointIPtr> endpoints = parseEndpoints(endpointInfo);
+ vector<EndpointIPtr> endpoints;
+ if(endpointInfo.empty())
+ {
+ endpoints = parseEndpoints(properties->getPropertyWithDefault(_propertyPrefix + _name + ".Endpoints",
+ properties->getProperty(_name + ".Endpoints")));
+ }
+ else
+ {
+ endpoints = parseEndpoints(endpointInfo);
+ }
for(vector<EndpointIPtr>::iterator p = endpoints.begin(); p != endpoints.end(); ++p)
{
_incomingConnectionFactories.push_back(new IncomingConnectionFactory(instance, *p, this, _name));
@@ -786,7 +823,8 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
// Parse published endpoints. If set, these are used in proxies
// instead of the connection factory endpoints.
//
- string endpts = _instance->initializationData().properties->getProperty(name + ".PublishedEndpoints");
+ string endpts = properties->getPropertyWithDefault(_propertyPrefix + _name + ".PublishedEndpoints",
+ properties->getProperty(_name + ".PublishedEndpoints"));
_publishedEndpoints = parseEndpoints(endpts);
if(_publishedEndpoints.empty())
{
@@ -801,11 +839,15 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
not1(Ice::constMemFun(&EndpointI::publish))), _publishedEndpoints.end());
}
- string locatorProperty = _name + ".Locator";
- if(!_instance->initializationData().properties->getProperty(locatorProperty).empty())
+ string locatorProperty = _propertyPrefix + _name + ".Locator";
+ if(!properties->getProperty(locatorProperty).empty())
{
setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(locatorProperty)));
}
+ else if(!properties->getProperty(_name + ".Locator").empty())
+ {
+ setLocator(LocatorPrx::uncheckedCast(_instance->proxyFactory()->propertyToProxy(_name + ".Locator")));
+ }
else
{
setLocator(_instance->referenceFactory()->getDefaultLocator());
@@ -813,11 +855,24 @@ Ice::ObjectAdapterI::ObjectAdapterI(const InstancePtr& instance, const Communica
if(!_instance->threadPerConnection())
{
- int size = _instance->initializationData().properties->getPropertyAsInt(_name + ".ThreadPool.Size");
- int sizeMax = _instance->initializationData().properties->getPropertyAsInt(_name + ".ThreadPool.SizeMax");
- if(size > 0 || sizeMax > 0)
+ if(!properties->getProperty(_propertyPrefix + _name + ".ThreadPool.Size").empty() ||
+ !properties->getProperty(_propertyPrefix + _name + ".ThreadPool.SizeMax").empty())
+ {
+ int size = properties->getPropertyAsInt(_propertyPrefix + _name + ".ThreadPool.Size");
+ int sizeMax = properties->getPropertyAsInt(_propertyPrefix + _name + ".ThreadPool.SizeMax");
+ if(size > 0 || sizeMax > 0)
+ {
+ _threadPool = new ThreadPool(_instance, _propertyPrefix + _name + ".ThreadPool", 0);
+ }
+ }
+ else
{
- _threadPool = new ThreadPool(_instance, _name + ".ThreadPool", 0);
+ int size = properties->getPropertyAsInt(_name + ".ThreadPool.Size");
+ int sizeMax = properties->getPropertyAsInt(_name + ".ThreadPool.SizeMax");
+ if(size > 0 || sizeMax > 0)
+ {
+ _threadPool = new ThreadPool(_instance, _name + ".ThreadPool", 0);
+ }
}
}
}
@@ -1082,6 +1137,37 @@ ObjectAdapterI::updateLocatorRegistry(const IceInternal::LocatorInfoPtr& locator
}
}
+StringSeq
+Ice::ObjectAdapterI::filterProperties(const string& prefix)
+{
+ static const string suffixes[] =
+ {
+ "AdapterId",
+ "Endpoints",
+ "Locator",
+ "PublishedEndpoints",
+ "RegisterProcess",
+ "ReplicaGroupId",
+ "Router",
+ "ThreadPool.Size",
+ "ThreadPool.SizeMax",
+ "ThreadPool.SizeWarn",
+ "ThreadPool.StackSize"
+ };
+
+ StringSeq propertySet;
+ PropertyDict props = _instance->initializationData().properties->getPropertiesForPrefix(prefix);
+ for(unsigned int i = 0; i < sizeof(suffixes)/sizeof(*suffixes); ++i)
+ {
+ if(props.find(prefix + suffixes[i]) != props.end())
+ {
+ propertySet.push_back(prefix + suffixes[i]);
+ }
+ }
+
+ return propertySet;
+}
+
Ice::ObjectAdapterI::ProcessI::ProcessI(const CommunicatorPtr& communicator) :
_communicator(communicator)
{
diff --git a/cpp/src/Ice/ObjectAdapterI.h b/cpp/src/Ice/ObjectAdapterI.h
index e90416cadc0..c3f198d91b8 100644
--- a/cpp/src/Ice/ObjectAdapterI.h
+++ b/cpp/src/Ice/ObjectAdapterI.h
@@ -27,6 +27,7 @@
#include <Ice/ThreadPoolF.h>
#include <Ice/Exception.h>
#include <Ice/Process.h>
+#include <Ice/BuiltinSequences.h>
#include <list>
namespace Ice
@@ -96,6 +97,7 @@ private:
static void checkIdentity(const Identity&);
std::vector<IceInternal::EndpointIPtr> parseEndpoints(const std::string&) const;
void updateLocatorRegistry(const IceInternal::LocatorInfoPtr&, const Ice::ObjectPrx&, bool);
+ Ice::StringSeq filterProperties(const std::string&);
bool _deactivated;
IceInternal::InstancePtr _instance;
@@ -117,6 +119,8 @@ private:
bool _waitForDeactivate;
bool _noConfig;
+ static std::string _propertyPrefix;
+
class ProcessI : public Process
{
public:
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp
index 2449070ce72..6e84d41e3a4 100644
--- a/cpp/src/Ice/PropertyNames.cpp
+++ b/cpp/src/Ice/PropertyNames.cpp
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `./config/PropertyNames.def', Mon Dec 11 11:13:50 2006
+// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Dec 18 13:40:21 2006
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -50,6 +50,17 @@ const char* IceInternal::PropertyNames::IceProps[] =
"Ice.MonitorConnections",
"Ice.Nohup",
"Ice.NullHandleAbort",
+ "Ice.OA.*.AdapterId",
+ "Ice.OA.*.Endpoints",
+ "Ice.OA.*.Locator",
+ "Ice.OA.*.PublishedEndpoints",
+ "Ice.OA.*.RegisterProcess",
+ "Ice.OA.*.ReplicaGroupId",
+ "Ice.OA.*.Router",
+ "Ice.OA.*.ThreadPool.Size",
+ "Ice.OA.*.ThreadPool.SizeMax",
+ "Ice.OA.*.ThreadPool.SizeWarn",
+ "Ice.OA.*.ThreadPool.StackSize",
"Ice.Override.Compress",
"Ice.Override.ConnectTimeout",
"Ice.Override.Timeout",
@@ -253,8 +264,8 @@ const char* IceInternal::PropertyNames::IceSSLProps[] =
"IceSSL.DefaultDir",
"IceSSL.DH.*",
"IceSSL.EntropyDaemon",
- "IceSSL.FindCert.*.*",
- "IceSSL.ImportCert.*.*",
+ "IceSSL.FindCert.*",
+ "IceSSL.ImportCert.*",
"IceSSL.KeyFile",
"IceSSL.Keystore",
"IceSSL.KeystorePassword",
@@ -396,11 +407,11 @@ const char* IceInternal::PropertyNames::FreezeProps[] =
"Freeze.DbEnv.*.DbRecoverFatal",
"Freeze.DbEnv.*.OldLogsAutoDelete",
"Freeze.DbEnv.*.PeriodicCheckpointMinSize",
- "Freeze.Evictor.*.*.MaxTxSize",
- "Freeze.Evictor.*.*.SavePeriod",
- "Freeze.Evictor.*.*.SaveSizeTrigger",
- "Freeze.Evictor.*.*.StreamTimeout",
- "Freeze.Evictor.*.*.PopulateEmptyIndices",
+ "Freeze.Evictor.*.MaxTxSize",
+ "Freeze.Evictor.*.SavePeriod",
+ "Freeze.Evictor.*.SaveSizeTrigger",
+ "Freeze.Evictor.*.StreamTimeout",
+ "Freeze.Evictor.*.PopulateEmptyIndices",
"Freeze.Evictor.UseNonmutating",
"Freeze.Trace.DbEnv",
"Freeze.Trace.Evictor",
diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h
index 5df9ba17997..c1bdfae9cbc 100644
--- a/cpp/src/Ice/PropertyNames.h
+++ b/cpp/src/Ice/PropertyNames.h
@@ -7,7 +7,7 @@
//
// **********************************************************************
-// Generated by makeprops.py from file `./config/PropertyNames.def', Mon Dec 11 11:13:50 2006
+// Generated by makeprops.py from file `../config/PropertyNames.def', Mon Dec 18 13:40:21 2006
// IMPORTANT: Do not edit this file -- any edits made here will be lost!