diff options
author | Marc Laukien <marc@zeroc.com> | 2001-12-07 16:23:30 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-12-07 16:23:30 +0000 |
commit | fb860ded9d0b326b5e3ac3930878dfa0aac4238e (patch) | |
tree | fcdfd2aeab607f4b088400df6225eac89b363f94 /cpp/src | |
parent | Release mode updates. (diff) | |
download | ice-fb860ded9d0b326b5e3ac3930878dfa0aac4238e.tar.bz2 ice-fb860ded9d0b326b5e3ac3930878dfa0aac4238e.tar.xz ice-fb860ded9d0b326b5e3ac3930878dfa0aac4238e.zip |
addPropertyPrefix
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/.depend | 3 | ||||
-rw-r--r-- | cpp/src/Ice/CommunicatorI.cpp | 79 | ||||
-rw-r--r-- | cpp/src/Ice/CommunicatorI.h | 1 | ||||
-rw-r--r-- | cpp/src/Ice/Initialize.cpp | 91 | ||||
-rw-r--r-- | cpp/src/Ice/Makefile | 3 | ||||
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 51 | ||||
-rw-r--r-- | cpp/src/Ice/PropertiesI.h | 3 | ||||
-rw-r--r-- | cpp/src/Ice/ice.dsp | 4 | ||||
-rw-r--r-- | cpp/src/IcePack/Client.cpp | 3 | ||||
-rw-r--r-- | cpp/src/IcePack/Server.cpp | 11 | ||||
-rw-r--r-- | cpp/src/IceStorm/Server.cpp | 8 | ||||
-rw-r--r-- | cpp/src/IceWall/Server.cpp | 6 |
12 files changed, 167 insertions, 96 deletions
diff --git a/cpp/src/Ice/.depend b/cpp/src/Ice/.depend index d54e3096d13..b9004fd26a6 100644 --- a/cpp/src/Ice/.depend +++ b/cpp/src/Ice/.depend @@ -1,3 +1,4 @@ +Initialize.o: Initialize.cpp ../Ice/CommunicatorI.h ../Ice/ThreadPoolF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Communicator.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/StreamF.h ../Ice/PropertiesI.h ../../include/Ice/Properties.h Application.o: Application.cpp ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/Stream.h ../../include/Ice/Communicator.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/StreamF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/Identity.h ../../include/Ice/ServantLocator.h ../../include/Ice/Current.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Object.h ../../include/Ice/IdentityUtil.h Exception.o: Exception.cpp ../../include/Ice/Exception.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/LocalException.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/IceUtil/Handle.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../Ice/Network.h LocalException.o: LocalException.cpp ../../include/Ice/LocalException.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h @@ -13,7 +14,7 @@ TraceLevels.o: TraceLevels.cpp ../Ice/TraceLevels.h ../../include/IceUtil/Shared TraceUtil.o: TraceUtil.cpp ../Ice/TraceUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../Ice/TraceLevelsF.h ../Ice/Instance.h ../../include/Ice/InstanceF.h ../../include/Ice/CommunicatorF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h ../../include/Ice/EmitterF.h ../Ice/ObjectFactoryManagerF.h ../Ice/UserExceptionFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../../include/Ice/Object.h ../../include/Ice/Proxy.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../Ice/TraceLevels.h ../../include/Ice/Logger.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../Ice/Protocol.h ../../include/Ice/IdentityUtil.h Instance.o: Instance.cpp ../Ice/Instance.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../../include/Ice/InstanceF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/CommunicatorF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/Ice/PropertiesF.h ../../include/Ice/LoggerF.h ../Ice/TraceLevelsF.h ../../include/Ice/ProxyFactoryF.h ../Ice/ThreadPoolF.h ../../include/Ice/EmitterF.h ../Ice/ObjectFactoryManagerF.h ../Ice/UserExceptionFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../Ice/TraceLevels.h ../Ice/ProxyFactory.h ../../include/Ice/ReferenceF.h ../Ice/ThreadPool.h ../Ice/EventHandlerF.h ../Ice/Emitter.h ../Ice/TransceiverF.h ../Ice/ConnectorF.h ../Ice/EndpointF.h ../Ice/EventHandler.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../Ice/ObjectFactoryManager.h ../../include/Ice/ObjectFactoryF.h ../Ice/UserExceptionFactoryManager.h ../../include/Ice/UserExceptionFactoryF.h ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/Identity.h ../../include/Ice/CollectorF.h ../../include/Ice/Properties.h ../Ice/LoggerI.h ../../include/Ice/Logger.h ../Ice/Network.h ../Ice/SysLoggerI.h Communicator.o: Communicator.cpp ../../include/Ice/Communicator.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/PropertiesF.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/StreamF.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h -CommunicatorI.o: CommunicatorI.cpp ../Ice/CommunicatorI.h ../Ice/ThreadPoolF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Communicator.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/StreamF.h ../Ice/PropertiesI.h ../../include/Ice/Properties.h ../Ice/Instance.h ../Ice/TraceLevelsF.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../Ice/ObjectFactoryManagerF.h ../Ice/UserExceptionFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../Ice/ProxyFactory.h ../../include/Ice/ReferenceF.h ../Ice/ThreadPool.h ../Ice/EventHandlerF.h ../Ice/ObjectFactoryManager.h ../Ice/UserExceptionFactoryManager.h ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/Identity.h ../../include/Ice/CollectorF.h ../Ice/EndpointF.h ../../include/Ice/Logger.h ../Ice/StreamI.h ../../include/Ice/Stream.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h +CommunicatorI.o: CommunicatorI.cpp ../Ice/CommunicatorI.h ../Ice/ThreadPoolF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Communicator.h ../../include/Ice/LoggerF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/StreamF.h ../Ice/Instance.h ../Ice/TraceLevelsF.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../Ice/ObjectFactoryManagerF.h ../Ice/UserExceptionFactoryManagerF.h ../../include/Ice/ObjectAdapterFactoryF.h ../../include/Ice/Properties.h ../Ice/ProxyFactory.h ../../include/Ice/ReferenceF.h ../Ice/ThreadPool.h ../Ice/EventHandlerF.h ../Ice/ObjectFactoryManager.h ../Ice/UserExceptionFactoryManager.h ../Ice/ObjectAdapterFactory.h ../Ice/ObjectAdapterI.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/Identity.h ../../include/Ice/CollectorF.h ../Ice/EndpointF.h ../../include/Ice/Logger.h ../Ice/StreamI.h ../../include/Ice/Stream.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ObjectFactory.o: ObjectFactory.cpp ../../include/Ice/ObjectFactory.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Object.h ObjectFactoryManager.o: ObjectFactoryManager.cpp ../Ice/ObjectFactoryManager.h ../../include/IceUtil/Shared.h ../../include/IceUtil/Config.h ../Ice/ObjectFactoryManagerF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/Ice/ObjectFactory.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ObjectAdapter.o: ObjectAdapter.cpp ../../include/Ice/ObjectAdapter.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ObjectF.h ../../include/Ice/Handle.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalException.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/CommunicatorF.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/Identity.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Proxy.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/EmitterF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Object.h diff --git a/cpp/src/Ice/CommunicatorI.cpp b/cpp/src/Ice/CommunicatorI.cpp index 60704936022..be257743546 100644 --- a/cpp/src/Ice/CommunicatorI.cpp +++ b/cpp/src/Ice/CommunicatorI.cpp @@ -9,8 +9,8 @@ // ********************************************************************** #include <Ice/CommunicatorI.h> -#include <Ice/PropertiesI.h> #include <Ice/Instance.h> +#include <Ice/Properties.h> #include <Ice/ProxyFactory.h> #include <Ice/ThreadPool.h> #include <Ice/ObjectFactoryManager.h> @@ -18,7 +18,6 @@ #include <Ice/ObjectAdapterFactory.h> #include <Ice/Logger.h> #include <Ice/StreamI.h> -#include <Ice/Initialize.h> #include <Ice/Exception.h> using namespace std; @@ -81,12 +80,18 @@ Ice::CommunicatorI::proxyToString(const ObjectPrx& proxy) ObjectAdapterPtr Ice::CommunicatorI::createObjectAdapter(const string& name) { + return createObjectAdapterFromProperty(name, "Ice.Adapter." + name + ".Endpoints"); +} + +ObjectAdapterPtr +Ice::CommunicatorI::createObjectAdapterFromProperty(const string& name, const string& property) +{ JTCSyncT<JTCRecursiveMutex> sync(*this); if (!_instance) { throw CommunicatorDestroyedException(__FILE__, __LINE__); } - string endpts = _instance->properties()->getProperty("Ice.Adapter." + name + ".Endpoints"); + string endpts = _instance->properties()->getProperty(property); return createObjectAdapterWithEndpoints(name, endpts); } @@ -240,71 +245,3 @@ Ice::CommunicatorI::~CommunicatorI() _instance->logger()->warning("communicator has not been destroyed"); } } - -CommunicatorPtr -Ice::initialize(int& argc, char* argv[], Int version) -{ -#ifndef ICE_IGNORE_VERSION - if (version != ICE_INT_VERSION) - { - throw VersionMismatchException(__FILE__, __LINE__); - } -#endif - - return new CommunicatorI(getDefaultProperties(argc, argv)); -} - -CommunicatorPtr -Ice::initializeWithProperties(const PropertiesPtr& properties, Int version) -{ -#ifndef ICE_IGNORE_VERSION - if (version != ICE_INT_VERSION) - { - throw VersionMismatchException(__FILE__, __LINE__); - } -#endif - - return new CommunicatorI(properties); -} - -static PropertiesPtr defaultProperties; -class DefaultPropertiesDestroyer -{ -public: - - ~DefaultPropertiesDestroyer() - { - defaultProperties = 0; - } -}; -static DefaultPropertiesDestroyer defaultPropertiesDestroyer; - -PropertiesPtr -Ice::getDefaultProperties(int& argc, char* argv[]) -{ - if (!defaultProperties) - { - defaultProperties = createProperties(argc, argv); - } - return defaultProperties; -} - -PropertiesPtr -Ice::createProperties(int& argc, char* argv[]) -{ - return new PropertiesI(argc, argv); -} - -PropertiesPtr -Ice::createPropertiesFromFile(int& argc, char* argv[], const string& file) -{ - return new PropertiesI(argc, argv, file); -} - -InstancePtr -IceInternal::getInstance(const CommunicatorPtr& communicator) -{ - CommunicatorI* p = dynamic_cast<CommunicatorI*>(communicator.get()); - assert(p); - return p->_instance; -} diff --git a/cpp/src/Ice/CommunicatorI.h b/cpp/src/Ice/CommunicatorI.h index d92aa80e91f..8801c98ca8e 100644 --- a/cpp/src/Ice/CommunicatorI.h +++ b/cpp/src/Ice/CommunicatorI.h @@ -30,6 +30,7 @@ public: virtual std::string proxyToString(const ObjectPrx&); virtual ObjectAdapterPtr createObjectAdapter(const std::string&); + virtual ObjectAdapterPtr createObjectAdapterFromProperty(const std::string&, const std::string&); virtual ObjectAdapterPtr createObjectAdapterWithEndpoints(const std::string&, const std::string&); virtual void addObjectFactory(const ObjectFactoryPtr&, const std::string&); diff --git a/cpp/src/Ice/Initialize.cpp b/cpp/src/Ice/Initialize.cpp new file mode 100644 index 00000000000..c2c9aa1740e --- /dev/null +++ b/cpp/src/Ice/Initialize.cpp @@ -0,0 +1,91 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/CommunicatorI.h> +#include <Ice/PropertiesI.h> +#include <Ice/Initialize.h> + +using namespace std; +using namespace Ice; +using namespace IceInternal; + +CommunicatorPtr +Ice::initialize(int& argc, char* argv[], Int version) +{ +#ifndef ICE_IGNORE_VERSION + if (version != ICE_INT_VERSION) + { + throw VersionMismatchException(__FILE__, __LINE__); + } +#endif + + return new CommunicatorI(getDefaultProperties(argc, argv)); +} + +CommunicatorPtr +Ice::initializeWithProperties(const PropertiesPtr& properties, Int version) +{ +#ifndef ICE_IGNORE_VERSION + if (version != ICE_INT_VERSION) + { + throw VersionMismatchException(__FILE__, __LINE__); + } +#endif + + return new CommunicatorI(properties); +} + +static PropertiesPtr defaultProperties; +class DefaultPropertiesDestroyer +{ +public: + + ~DefaultPropertiesDestroyer() + { + defaultProperties = 0; + } +}; +static DefaultPropertiesDestroyer defaultPropertiesDestroyer; + +PropertiesPtr +Ice::getDefaultProperties(int& argc, char* argv[]) +{ + if (!defaultProperties) + { + defaultProperties = createProperties(argc, argv); + } + return defaultProperties; +} + +PropertiesPtr +Ice::createProperties(int& argc, char* argv[]) +{ + return new PropertiesI(argc, argv); +} + +PropertiesPtr +Ice::createPropertiesFromFile(int& argc, char* argv[], const string& file) +{ + return new PropertiesI(argc, argv, file); +} + +void +Ice::addArgumentPrefix(const std::string& prefix) +{ + PropertiesI::addArgumentPrefix(prefix); +} + +InstancePtr +IceInternal::getInstance(const CommunicatorPtr& communicator) +{ + CommunicatorI* p = dynamic_cast<CommunicatorI*>(communicator.get()); + assert(p); + return p->_instance; +} diff --git a/cpp/src/Ice/Makefile b/cpp/src/Ice/Makefile index c6655736f87..5498dcb0004 100644 --- a/cpp/src/Ice/Makefile +++ b/cpp/src/Ice/Makefile @@ -18,7 +18,8 @@ VERSIONED_NAME = $(top_srcdir)/lib/$(VERSIONED_BASE) TARGETS = $(NAME) $(VERSIONED_NAME) -OBJS = Application.o \ +OBJS = Initialize.o \ + Application.o \ Exception.o \ LocalException.o \ Properties.o \ diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index a3aa9fc77cf..e119d8bc0ba 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -16,6 +16,8 @@ using namespace std; using namespace Ice; using namespace IceInternal; +std::set<string> Ice::PropertiesI::_argumentPrefixes; + string Ice::PropertiesI::getProperty(const string& key) { @@ -45,6 +47,12 @@ Ice::PropertiesI::clone() return p; } +void +Ice::PropertiesI::addArgumentPrefix(const std::string& prefix) +{ + _argumentPrefixes.insert(prefix); +} + Ice::PropertiesI::PropertiesI(int& argc, char* argv[]) { for (int i = 1; i < argc; ++i) @@ -111,23 +119,40 @@ Ice::PropertiesI::parseArgs(int& argc, char* argv[]) int idx = 1; while (idx < argc) { - if (strncmp(argv[idx], "--Ice.", 6) == 0) + bool match = false; + string arg = argv[idx]; + string::size_type beg = arg.find("--"); + if (beg == 0) { - string line = argv[idx]; - for (int i = idx ; i + 1 < argc ; ++i) + string::size_type end = arg.find('.'); + if (end != string::npos) { - argv[i] = argv[i + 1]; + string prefix = arg.substr(2, end - 2); + + if (prefix == "Ice" || _argumentPrefixes.find(prefix) != _argumentPrefixes.end()) + { + match = true; + } + + if (match) + { + for (int i = idx ; i + 1 < argc ; ++i) + { + argv[i] = argv[i + 1]; + } + --argc; + + if (arg.find('=') == string::npos) + { + arg += "=1"; + } + + parseLine(arg.substr(2)); + } } - --argc; - - if (line.find('=') == string::npos) - { - line += "=1"; - } - - parseLine(line.substr(2)); } - else + + if (!match) { ++idx; } diff --git a/cpp/src/Ice/PropertiesI.h b/cpp/src/Ice/PropertiesI.h index 0a4027d18d6..255f7f0fb46 100644 --- a/cpp/src/Ice/PropertiesI.h +++ b/cpp/src/Ice/PropertiesI.h @@ -12,6 +12,7 @@ #define ICE_PROPERTIES_I_H #include <Ice/Properties.h> +#include <set> namespace Ice { @@ -23,6 +24,7 @@ public: virtual std::string getProperty(const std::string&); virtual void setProperty(const std::string&, const std::string&); virtual PropertiesPtr clone(); + static void addArgumentPrefix(const std::string&); private: @@ -37,6 +39,7 @@ private: void parseLine(const std::string&); std::map<std::string, std::string> _properties; + static std::set<std::string> _argumentPrefixes; }; } diff --git a/cpp/src/Ice/ice.dsp b/cpp/src/Ice/ice.dsp index 51243de1206..5b14d25dafa 100644 --- a/cpp/src/Ice/ice.dsp +++ b/cpp/src/Ice/ice.dsp @@ -168,6 +168,10 @@ SOURCE=.\Incoming.cpp # End Source File
# Begin Source File
+SOURCE=.\Initialize.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\Instance.cpp
# End Source File
# Begin Source File
diff --git a/cpp/src/IcePack/Client.cpp b/cpp/src/IcePack/Client.cpp index 5f4e7eb7d20..8603fb574ef 100644 --- a/cpp/src/IcePack/Client.cpp +++ b/cpp/src/IcePack/Client.cpp @@ -27,6 +27,7 @@ public: int main(int argc, char* argv[]) { + addArgumentPrefix("IcePack"); Client app; return app.main(argc, argv); } @@ -137,7 +138,7 @@ Client::run(int argc, char* argv[]) } PropertiesPtr properties = communicator()->getProperties(); - const char* adminEndpointsProperty = "Ice.Adapter.Admin.Endpoints"; + const char* adminEndpointsProperty = "IcePack.Admin.Endpoints"; string adminEndpoints = properties->getProperty(adminEndpointsProperty); if (adminEndpoints.empty()) { diff --git a/cpp/src/IcePack/Server.cpp b/cpp/src/IcePack/Server.cpp index 7a0f7e8be28..3a2857db0f0 100644 --- a/cpp/src/IcePack/Server.cpp +++ b/cpp/src/IcePack/Server.cpp @@ -27,6 +27,7 @@ public: int main(int argc, char* argv[]) { + addArgumentPrefix("IcePack"); Server app; return app.main(argc, argv); } @@ -73,7 +74,7 @@ Server::run(int argc, char* argv[]) PropertiesPtr properties = communicator()->getProperties(); - const char* adminEndpointsProperty = "Ice.Adapter.Admin.Endpoints"; + const char* adminEndpointsProperty = "IcePack.Admin.Endpoints"; string adminEndpoints = properties->getProperty(adminEndpointsProperty); if (!adminEndpoints.empty() && !nowarn) { @@ -81,7 +82,7 @@ Server::run(int argc, char* argv[]) << endl; } - const char* forwardEndpointsProperty = "Ice.Adapter.Forward.Endpoints"; + const char* forwardEndpointsProperty = "IcePack.Forward.Endpoints"; string forwardEndpoints = properties->getProperty(forwardEndpointsProperty); if (forwardEndpoints.empty()) { @@ -94,12 +95,14 @@ Server::run(int argc, char* argv[]) if (adminEndpoints.length() != 0) { - ObjectAdapterPtr adminAdapter = communicator()->createObjectAdapter("Admin"); + ObjectAdapterPtr adminAdapter = communicator()->createObjectAdapterFromProperty("Admin", + adminEndpointsProperty); adminAdapter->add(admin, stringToIdentity("admin")); adminAdapter->activate(); } - ObjectAdapterPtr forwardAdapter = communicator()->createObjectAdapter("Forward"); + ObjectAdapterPtr forwardAdapter = communicator()->createObjectAdapterFromProperty("Forward", + forwardEndpointsProperty); forwardAdapter->addServantLocator(forward, ""); forwardAdapter->activate(); diff --git a/cpp/src/IceStorm/Server.cpp b/cpp/src/IceStorm/Server.cpp index 1b4e8455585..b5ff66fde5b 100644 --- a/cpp/src/IceStorm/Server.cpp +++ b/cpp/src/IceStorm/Server.cpp @@ -70,13 +70,13 @@ main(int argc, char* argv[]) usage(argv[0]); return EXIT_FAILURE; } - dbdir = argv[i+1]; + dbdir = argv[i + 1]; // // Consume arguments // while (i < argc - 2) { - argv[i] = argv[i+2]; + argv[i] = argv[i + 2]; ++i; } argc -= 2; @@ -87,6 +87,7 @@ main(int argc, char* argv[]) } } + addArgumentPrefix("IcePack"); Server app(dbdir); return app.main(argc, argv); } @@ -129,7 +130,8 @@ IceStorm::Server::runFreeze(int argc, char* argv[], const Freeze::DBEnvironmentP //PropertiesPtr properties = communicator()->getProperties(); TraceLevelsPtr traceLevels = new TraceLevels(communicator()->getProperties()); - ObjectAdapterPtr adapter = communicator()->createObjectAdapter("TopicManager"); + ObjectAdapterPtr adapter = communicator()->createObjectAdapterFromProperty("TopicManager", + "IceStorm.TopicManager.Endpoints"); ObjectPtr object = new TopicManagerI(communicator(), adapter, traceLevels, dbTopicManager); adapter->add(object, stringToIdentity("TopicManager")); adapter->activate(); diff --git a/cpp/src/IceWall/Server.cpp b/cpp/src/IceWall/Server.cpp index b6a79f75baf..19f993ed582 100644 --- a/cpp/src/IceWall/Server.cpp +++ b/cpp/src/IceWall/Server.cpp @@ -26,6 +26,7 @@ public: int main(int argc, char* argv[]) { + addArgumentPrefix("IceWall"); Server app; return app.main(argc, argv); } @@ -66,7 +67,7 @@ Server::run(int argc, char* argv[]) PropertiesPtr properties = communicator()->getProperties(); - const char* routerEndpointsProperty = "Ice.Adapter.Router.Endpoints"; + const char* routerEndpointsProperty = "IceWall.Router.Endpoints"; string routerEndpoints = properties->getProperty(routerEndpointsProperty); if (routerEndpoints.empty()) { @@ -76,7 +77,8 @@ Server::run(int argc, char* argv[]) ServantLocatorPtr router = new Router; - ObjectAdapterPtr routerAdapter = communicator()->createObjectAdapter("Router"); + ObjectAdapterPtr routerAdapter = communicator()->createObjectAdapterFromProperty("Router", + routerEndpointsProperty); routerAdapter->addServantLocator(router, ""); routerAdapter->activate(); |