diff options
author | Mark Spruiell <mes@zeroc.com> | 2003-08-08 19:35:01 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2003-08-08 19:35:01 +0000 |
commit | aa904c308f18f38ea49fb94765e3f20cf01a289c (patch) | |
tree | 33a6c87e18ca7410c533fe1454f5a521567f75dc /cpp | |
parent | Added Properties::parseIceCommandLineOptions(). (diff) | |
download | ice-aa904c308f18f38ea49fb94765e3f20cf01a289c.tar.bz2 ice-aa904c308f18f38ea49fb94765e3f20cf01a289c.tar.xz ice-aa904c308f18f38ea49fb94765e3f20cf01a289c.zip |
adding support for a default object factory
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/CHANGES | 7 | ||||
-rw-r--r-- | cpp/src/Ice/BasicStream.cpp | 24 |
2 files changed, 29 insertions, 2 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES index 7bae539bed2..1e592ef55a5 100644 --- a/cpp/CHANGES +++ b/cpp/CHANGES @@ -1,6 +1,10 @@ Changes since version 1.1.0 --------------------------- +- Added support for a default object factory, similar to the semantics of servant + locators. Specifically, a factory registered with an empty type id is invoked + when a type-specific factory cannot not be found. + - Added Ice::Properties::parseIceCommandLineOptions(). This operation converts to properties all options that start with one of the following prefixes: --Ice, --IceBox, --IcePack, --IcePatch, --IceSSL, --IceStorm, --Freeze, and --Glacier. @@ -19,8 +23,7 @@ Changes since version 1.1.0 - Added Linux/SPARC port from Ferris McCormick -- Fixed a bug where daemonized Ice::Application wouldn't shutdown - properly. +- Fixed a bug where daemonized Ice::Application wouldn't shutdown properly. - Major Freeze update: diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index c672e456c08..ed0e50a54ff 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -1233,17 +1233,41 @@ IceInternal::BasicStream::read(PatchFunc patchFunc, void* patchAddr) string id; readTypeId(id); + // + // Try to find a factory registered for the specific type. + // ObjectFactoryPtr userFactory = _instance->servantFactoryManager()->find(id); if(userFactory) { v = userFactory->create(id); } + // + // If that fails, invoke the default factory if one has been registered. + // + if(!v) + { + userFactory = _instance->servantFactoryManager()->find(""); + if(userFactory) + { + v = userFactory->create(id); + } + } + + // + // There isn't a static factory for Ice::Object, so check for that case now. + // We do this *after* the factory inquiries above so that a factory could be + // registered for "::Ice::Object". + // if(!v && id == Ice::Object::ice_staticId()) { v = new ::Ice::Object; } + // + // Last chance: check the table of static factories (i.e., automatically generated + // factories for concrete classes). + // if(!v) { ObjectFactoryPtr of = Ice::factoryTable->getObjectFactory(id); |