diff options
author | Benoit Foucher <benoit@zeroc.com> | 2002-07-23 17:53:26 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2002-07-23 17:53:26 +0000 |
commit | 90293be65a80e5fe3c9fa968c8b59b25dfc5c673 (patch) | |
tree | ad29c92bb5ee4c57ee3e458200197a1d0493a844 /cpp/src | |
parent | Fixes (diff) | |
download | ice-90293be65a80e5fe3c9fa968c8b59b25dfc5c673.tar.bz2 ice-90293be65a80e5fe3c9fa968c8b59b25dfc5c673.tar.xz ice-90293be65a80e5fe3c9fa968c8b59b25dfc5c673.zip |
Added persistence and fixed numerous bugs.
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Freeze/EvictorI.cpp | 3 | ||||
-rw-r--r-- | cpp/src/IcePack/.depend | 11 | ||||
-rw-r--r-- | cpp/src/IcePack/AdapterManager.ice | 7 | ||||
-rw-r--r-- | cpp/src/IcePack/AdapterManagerI.cpp | 112 | ||||
-rw-r--r-- | cpp/src/IcePack/AdapterManagerI.h | 7 | ||||
-rw-r--r-- | cpp/src/IcePack/AdminI.cpp | 22 | ||||
-rw-r--r-- | cpp/src/IcePack/ComponentDeployer.cpp | 111 | ||||
-rw-r--r-- | cpp/src/IcePack/ComponentDeployer.h | 6 | ||||
-rw-r--r-- | cpp/src/IcePack/Makefile | 2 | ||||
-rw-r--r-- | cpp/src/IcePack/Parser.cpp | 5 | ||||
-rw-r--r-- | cpp/src/IcePack/Server.cpp | 98 | ||||
-rw-r--r-- | cpp/src/IcePack/ServerDeployer.cpp | 166 | ||||
-rw-r--r-- | cpp/src/IcePack/ServerDeployer.h | 29 | ||||
-rw-r--r-- | cpp/src/IcePack/ServerManager.ice | 12 | ||||
-rw-r--r-- | cpp/src/IcePack/ServerManagerI.cpp | 137 | ||||
-rw-r--r-- | cpp/src/IcePack/ServerManagerI.h | 10 | ||||
-rw-r--r-- | cpp/src/IcePack/ServiceDeployer.cpp | 24 | ||||
-rw-r--r-- | cpp/src/IcePack/ServiceDeployer.h | 6 |
18 files changed, 500 insertions, 268 deletions
diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp index e1b83cd709b..3c7b8b0fd25 100644 --- a/cpp/src/Freeze/EvictorI.cpp +++ b/cpp/src/Freeze/EvictorI.cpp @@ -402,9 +402,8 @@ Freeze::EvictorI::evict() // // Remove last unused element from the evictor queue. // - _evictorList.erase(element->position); + p = list<Identity>::reverse_iterator(_evictorList.erase(element->position)); _evictorMap.erase(q); - ++p; if(_trace >= 2) { diff --git a/cpp/src/IcePack/.depend b/cpp/src/IcePack/.depend index 227d8d47f1c..a7c44535ce5 100644 --- a/cpp/src/IcePack/.depend +++ b/cpp/src/IcePack/.depend @@ -6,10 +6,13 @@ Grammar.o: Grammar.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h .. Scanner.o: Scanner.cpp ../../include/IceUtil/Config.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/Parser.h ../../include/IcePack/Admin.h ../IcePack/Grammar.h Parser.o: Parser.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/Parser.h ../../include/IcePack/Admin.h Client.o: Client.cpp ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/Parser.h ../../include/IcePack/Admin.h -Server.o: Server.cpp ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/LocatorI.h ../../include/Ice/Locator.h ../IcePack/AdapterManagerF.h ../IcePack/LocatorRegistryI.h ../IcePack/ServerManagerI.h ../IcePack/ServerManager.h ../../include/IcePack/Admin.h ../IcePack/AdapterManager.h ../IcePack/Activator.h ../IcePack/ServerManagerF.h ../IcePack/AdapterManagerI.h ../IcePack/AdminI.h ../IcePack/ActivatorI.h ../../include/IceUtil/Thread.h -AdapterManagerI.o: AdapterManagerI.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/AdapterManagerI.h ../IcePack/AdapterManager.h ../../include/IcePack/Admin.h ../IcePack/ServerManager.h -ServerManagerI.o: ServerManagerI.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../IcePack/ServerManagerI.h ../IcePack/ServerManager.h ../../include/IcePack/Admin.h ../IcePack/AdapterManager.h ../IcePack/Activator.h ../IcePack/ServerManagerF.h +Server.o: Server.cpp ../../include/Freeze/Application.h ../../include/Ice/Application.h ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Freeze/Freeze.h ../../include/Freeze/Initialize.h ../../include/Freeze/DBF.h ../../include/Freeze/DB.h ../../include/Freeze/DBException.h ../../include/Freeze/EvictorF.h ../../include/Freeze/Evictor.h ../../include/Freeze/Map.h ../IcePack/LocatorI.h ../../include/Ice/Locator.h ../IcePack/AdapterManagerF.h ../IcePack/LocatorRegistryI.h ../IcePack/ServerManagerI.h ../IcePack/ServerManager.h ../../include/IcePack/Admin.h ../IcePack/AdapterManager.h ../IcePack/Activator.h ../IcePack/ServerManagerF.h ../IcePack/AdapterManagerI.h ../IcePack/AdminI.h ../IcePack/ActivatorI.h ../../include/IceUtil/Thread.h +AdapterManagerI.o: AdapterManagerI.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Freeze/DB.h ../../include/Freeze/DBException.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h ../../include/Freeze/Evictor.h ../IcePack/AdapterManagerI.h ../IcePack/AdapterManager.h ../../include/IcePack/Admin.h ../IcePack/ServerManager.h +ServerManagerI.o: ServerManagerI.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Freeze/DB.h ../../include/Freeze/DBException.h ../../include/Freeze/DBF.h ../../include/Freeze/EvictorF.h ../../include/Freeze/Evictor.h ../../include/Ice/Functional.h ../../include/IceUtil/Functional.h ../IcePack/ServerManagerI.h ../IcePack/ServerManager.h ../../include/IcePack/Admin.h ../IcePack/AdapterManager.h ../IcePack/Activator.h ../IcePack/ServerManagerF.h ../IcePack/ServerDeployer.h ../IcePack/ComponentDeployer.h ../../include/Yellow/Yellow.h ../IcePack/AdapterManagerF.h +ComponentDeployer.o: ComponentDeployer.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/Ice/Locator.h ../IcePack/ComponentDeployer.h ../../include/Yellow/Yellow.h ../../include/IcePack/Admin.h +ServerDeployer.o: ServerDeployer.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/ServerDeployer.h ../IcePack/ComponentDeployer.h ../../include/Yellow/Yellow.h ../../include/IcePack/Admin.h ../IcePack/ServerManagerF.h ../IcePack/AdapterManagerF.h ../IcePack/ServiceDeployer.h ../IcePack/AdapterManager.h ../IcePack/ServerManager.h +ServiceDeployer.o: ServiceDeployer.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/ServiceDeployer.h ../IcePack/ComponentDeployer.h ../../include/Yellow/Yellow.h ../IcePack/ServerDeployer.h ../../include/IcePack/Admin.h ../IcePack/ServerManagerF.h ../IcePack/AdapterManagerF.h LocatorI.o: LocatorI.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/AdapterManager.h ../../include/IcePack/Admin.h ../IcePack/LocatorI.h ../../include/Ice/Locator.h ../IcePack/AdapterManagerF.h LocatorRegistryI.o: LocatorRegistryI.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/AdapterManager.h ../../include/IcePack/Admin.h ../IcePack/LocatorRegistryI.h ../../include/Ice/Locator.h ../IcePack/AdapterManagerF.h -AdminI.o: AdminI.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/AdminI.h ../../include/IcePack/Admin.h ../IcePack/ServerManagerF.h ../IcePack/AdapterManagerF.h ../IcePack/ServerManager.h ../IcePack/AdapterManager.h +AdminI.o: AdminI.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/AdminI.h ../../include/IcePack/Admin.h ../IcePack/ServerManagerF.h ../IcePack/AdapterManagerF.h ../IcePack/ServerManager.h ../IcePack/AdapterManager.h ../IcePack/ServerDeployer.h ../IcePack/ComponentDeployer.h ../../include/Yellow/Yellow.h ActivatorI.o: ActivatorI.cpp ../../include/Ice/Ice.h ../../include/Ice/Initialize.h ../../include/Ice/CommunicatorF.h ../../include/Ice/LocalObjectF.h ../../include/Ice/Handle.h ../../include/IceUtil/Handle.h ../../include/IceUtil/Exception.h ../../include/IceUtil/Config.h ../../include/Ice/Config.h ../../include/Ice/ProxyF.h ../../include/Ice/ProxyHandle.h ../../include/Ice/ObjectF.h ../../include/Ice/Exception.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Proxy.h ../../include/IceUtil/Mutex.h ../../include/IceUtil/Lock.h ../../include/Ice/ProxyFactoryF.h ../../include/Ice/ConnectionF.h ../../include/Ice/EndpointF.h ../../include/Ice/ObjectAdapterF.h ../../include/Ice/ReferenceF.h ../../include/Ice/Current.h ../../include/Ice/Identity.h ../../include/Ice/Facet.h ../../include/Ice/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/IceUtil/Time.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/ObjectFactoryF.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/LocalException.h ../../include/Ice/Properties.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/LocatorF.h ../../include/Ice/PluginF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePack/ActivatorI.h ../../include/IceUtil/Thread.h ../IcePack/Activator.h ../IcePack/ServerManagerF.h ../../include/IcePack/Admin.h ../IcePack/ServerManager.h ../IcePack/AdapterManager.h diff --git a/cpp/src/IcePack/AdapterManager.ice b/cpp/src/IcePack/AdapterManager.ice index cf4cbc7e22d..69ae45c89e1 100644 --- a/cpp/src/IcePack/AdapterManager.ice +++ b/cpp/src/IcePack/AdapterManager.ice @@ -118,13 +118,6 @@ class Adapter * */ Object* _proxy; - - /** - * - * The state of the adapter, true if active false otherwise. - * - */ - bool _active; }; /** diff --git a/cpp/src/IcePack/AdapterManagerI.cpp b/cpp/src/IcePack/AdapterManagerI.cpp index 4eebb8a2a75..f5bfc92a7f4 100644 --- a/cpp/src/IcePack/AdapterManagerI.cpp +++ b/cpp/src/IcePack/AdapterManagerI.cpp @@ -9,6 +9,8 @@ // ********************************************************************** #include <Ice/Ice.h> +#include <Freeze/DB.h> +#include <Freeze/Evictor.h> #include <IcePack/AdapterManagerI.h> #include <IcePack/ServerManager.h> @@ -16,8 +18,65 @@ using namespace std; using namespace Ice; using namespace IcePack; +namespace IcePack +{ + +class AdapterNameToAdapter +{ +public: + + AdapterNameToAdapter(const ObjectAdapterPtr& adapter) : + _adapter(adapter) + { + } + + AdapterPrx + operator()(const string& name) + { + Identity ident; + ident.category = "adapter"; + ident.name = name; + return AdapterPrx::uncheckedCast(_adapter->createProxy(ident)); + } + +private: + + ObjectAdapterPtr _adapter; +}; + +class AdapterFactory : public ObjectFactory +{ +public: + + AdapterFactory(int waitTime) : _waitTime(waitTime) + { + } + + // + // Operations from ObjectFactory + // + virtual Ice::ObjectPtr + create(const std::string& type) + { + assert(type == "::IcePack::Adapter"); + return new AdapterI(_waitTime); + } + + virtual void + destroy() + { + } + +private: + + int _waitTime; +}; + +} + IcePack::AdapterI::AdapterI(Int waitTime) : - _waitTime(waitTime) + _waitTime(waitTime), + _active(false) { } @@ -87,34 +146,32 @@ IcePack::AdapterI::markAsInactive(const Current&) notifyAll(); } -class AdapterNameToAdapter +IcePack::AdapterManagerI::AdapterManagerI(const ObjectAdapterPtr& adapter, const Freeze::DBEnvironmentPtr& dbEnv) : + _adapter(adapter) { -public: + Ice::PropertiesPtr properties = adapter->getCommunicator()->getProperties(); + _waitTime = properties->getPropertyAsIntWithDefault("IcePack.Activation.WaitTime", 60); - AdapterNameToAdapter(const ObjectAdapterPtr& adapter) : - _adapter(adapter) - { - } + ObjectFactoryPtr adapterFactory = new AdapterFactory(_waitTime); + adapter->getCommunicator()->addObjectFactory(adapterFactory, "::IcePack::Adapter"); - AdapterPrx - operator()(const string& name) + Freeze::DBPtr dbAdapters = dbEnv->openDB("adapters", true); + _evictor = dbAdapters->createEvictor(Freeze::SaveUponEviction); + _evictor->setSize(100); + _adapter->addServantLocator(_evictor, "adapter"); + + // + // Cache the server names for getAll(). This will load all the + // server objects at the begining and might cause slow startup. + // + Freeze::EvictorIteratorPtr p = _evictor->getIterator(); + while(p->hasNext()) { - Identity ident; - ident.category = "adapter"; - ident.name = name; - return AdapterPrx::uncheckedCast(_adapter->createProxy(ident)); + AdapterPrx a = AdapterPrx::checkedCast(_adapter->createProxy(p->next())); + assert(a); + AdapterDescription desc = a->getAdapterDescription(); + _adapterNames.insert(desc.name); } - -private: - - ObjectAdapterPtr _adapter; -}; - -IcePack::AdapterManagerI::AdapterManagerI(const ObjectAdapterPtr& adapter) : - _adapter(adapter) -{ - Ice::PropertiesPtr properties = adapter->getCommunicator()->getProperties(); - _waitTime = properties->getPropertyAsIntWithDefault("IcePack.Activation.WaitTime", 60); } AdapterPrx @@ -138,7 +195,6 @@ IcePack::AdapterManagerI::create(const AdapterDescription& description, const Cu AdapterPtr adapterI = new AdapterI(_waitTime); adapterI->_description = description; - adapterI->_active = false; adapterI->_proxy = 0; // @@ -146,7 +202,9 @@ IcePack::AdapterManagerI::create(const AdapterDescription& description, const Cu // _adapterNames.insert(description.name); - return AdapterPrx::uncheckedCast(_adapter->add(adapterI, adapter->ice_getIdentity())); + _evictor->createObject(adapter->ice_getIdentity(), adapterI); + + return adapter; } AdapterPrx @@ -179,7 +237,7 @@ IcePack::AdapterManagerI::remove(const string& name, const Current&) throw AdapterNotExistException(); } - _adapter->remove(adapter->ice_getIdentity()); + _evictor->destroyObject(adapter->ice_getIdentity()); // // Remove the adapter name from our internal name set. diff --git a/cpp/src/IcePack/AdapterManagerI.h b/cpp/src/IcePack/AdapterManagerI.h index ec9d7d0d36b..61a5ee81e2d 100644 --- a/cpp/src/IcePack/AdapterManagerI.h +++ b/cpp/src/IcePack/AdapterManagerI.h @@ -13,6 +13,7 @@ #include <IceUtil/Mutex.h> #include <IceUtil/Monitor.h> +#include <Freeze/DBF.h> #include <IcePack/AdapterManager.h> #include <set> @@ -34,14 +35,15 @@ public: private: - ::Ice::Int _waitTime; + ::Ice::Int _waitTime; + bool _active; }; class AdapterManagerI : public AdapterManager, public IceUtil::Mutex { public: - AdapterManagerI(const Ice::ObjectAdapterPtr&); + AdapterManagerI(const Ice::ObjectAdapterPtr&, const Freeze::DBEnvironmentPtr&); virtual AdapterPrx create(const AdapterDescription&, const ::Ice::Current&); virtual AdapterPrx findByName(const ::std::string&, const ::Ice::Current&); @@ -51,6 +53,7 @@ public: private: ::Ice::ObjectAdapterPtr _adapter; + ::Freeze::EvictorPtr _evictor; ::std::set< ::std::string> _adapterNames; ::Ice::Int _waitTime; }; diff --git a/cpp/src/IcePack/AdminI.cpp b/cpp/src/IcePack/AdminI.cpp index 7a47b2f9985..4b385cdc421 100644 --- a/cpp/src/IcePack/AdminI.cpp +++ b/cpp/src/IcePack/AdminI.cpp @@ -12,6 +12,7 @@ #include <IcePack/AdminI.h> #include <IcePack/ServerManager.h> #include <IcePack/AdapterManager.h> +#include <IcePack/ServerDeployer.h> using namespace std; using namespace Ice; @@ -29,7 +30,11 @@ void IcePack::AdminI::addServer(const string& name, const string& path, const string& ldpath, const string& descriptor, const Current&) { - _serverManager->create(name, path, ldpath, descriptor); + ServerDeployer deployer(_communicator, name, path, ldpath); + deployer.setServerManager(_serverManager); + deployer.setAdapterManager(_adapterManager); + deployer.parse(descriptor); + deployer.deploy(); } ServerDescription @@ -86,7 +91,20 @@ IcePack::AdminI::startServer(const string& name, const Current&) void IcePack::AdminI::removeServer(const string& name, const Current&) { - _serverManager->remove(name); + ServerPrx server = _serverManager->findByName(name); + if(!server) + { + throw ServerNotExistException(); + } + + server->setState(Destroyed); + ServerDescription desc = server->getServerDescription(); + + ServerDeployer deployer(_communicator, desc.name, desc.path, ""); + deployer.setServerManager(_serverManager); + deployer.setAdapterManager(_adapterManager); + deployer.parse(desc.descriptor); + deployer.undeploy(); } ServerNames diff --git a/cpp/src/IcePack/ComponentDeployer.cpp b/cpp/src/IcePack/ComponentDeployer.cpp index ca429de68de..b267db0f204 100644 --- a/cpp/src/IcePack/ComponentDeployer.cpp +++ b/cpp/src/IcePack/ComponentDeployer.cpp @@ -9,6 +9,7 @@ // ********************************************************************** #include <Ice/Ice.h> +#include <Ice/Locator.h> #include <IcePack/ComponentDeployer.h> #include <IcePack/Admin.h> @@ -95,6 +96,7 @@ class GenerateConfiguration : public Task class WriteConfigProperty : public unary_function<Ice::PropertyDict::value_type, string> { public: + string operator()(const Ice::PropertyDict::value_type& p) const { @@ -243,7 +245,24 @@ IcePack::ComponentDeployHandler::startElement(const XMLCh *const name, Attribute if(str == "property") { - _deployer.addProperty(getAttributeValue(attrs, "name"), getAttributeValue(attrs, "value")); + string value = getAttributeValueWithDefault(attrs, "value", ""); + if(value.empty()) + { + value = getAttributeValueWithDefault(attrs, "location", ""); + if(!value.empty() && value[0] != '/') + { + value = _deployer.substitute("${basedir}/") + value; + } + } + _deployer.addProperty(getAttributeValue(attrs, "name"), value); + } + else if(str == "adapter") + { + _adapter = getAttributeValue(attrs, "name"); + } + else if(str == "offer") + { + _deployer.addOffer(getAttributeValue(attrs, "interface"), _adapter, getAttributeValue(attrs, "identity")); } } @@ -251,6 +270,13 @@ void IcePack::ComponentDeployHandler::endElement(const XMLCh *const name) { _elements.pop(); + + string str = toString(name); + + if(str == "adapter") + { + _adapter = ""; + } } string @@ -266,7 +292,7 @@ IcePack::ComponentDeployHandler::getAttributeValue(const AttributeList& attrs, c return ""; } - return toString(value); + return _deployer.substitute(toString(value)); } string @@ -279,11 +305,11 @@ IcePack::ComponentDeployHandler::getAttributeValueWithDefault(const AttributeLis if(value == 0) { - return def; + return _deployer.substitute(def); } else { - return toString(value); + return _deployer.substitute(toString(value)); } } @@ -303,17 +329,9 @@ IcePack::ComponentDeployer::ComponentDeployer(const Ice::CommunicatorPtr& commun _communicator(communicator), _properties(Ice::createProperties()) { - _variables["datadir"] = _communicator->getProperties()->getProperty("IcePack.Data"); - assert(!_variables["datadir"].empty()); - - try - { - _yellowAdmin = Yellow::AdminPrx::checkedCast( - _communicator->stringToProxy(_communicator->getProperties()->getProperty("IcePack.Yellow.Admin"))); - } - catch(Ice::LocalException&) - { - } + string serversPath = _communicator->getProperties()->getProperty("IcePack.Data"); + assert(!serversPath.empty()); + _variables["datadir"] = serversPath + (serversPath[serversPath.length() - 1] == '/' ? "" : "/") + "servers"; } void @@ -321,6 +339,21 @@ IcePack::ComponentDeployer::parse(const string& xmlFile, ComponentDeployHandler& { _error = 0; + // + // Setup the base directory for this deploment descriptor to the + // location of the desciptor file. + // + string::size_type end = xmlFile.find_last_of('/'); + if(end != string::npos) + { + _variables["basedir"] = xmlFile.substr(0, end); + } + + if(_variables["basedir"].empty()) + { + _variables["basedir"] = "."; + } + SAXParser* parser = new SAXParser; parser->setValidationScheme(SAXParser::Val_Never); @@ -334,6 +367,7 @@ IcePack::ComponentDeployer::parse(const string& xmlFile, ComponentDeployHandler& catch(const XMLException& e) { cerr << "XMLException: " << toString(e.getMessage()) << endl; + _error++; } int rc = parser->getErrorCount(); delete parser; @@ -397,7 +431,7 @@ IcePack::ComponentDeployer::undeploy() void IcePack::ComponentDeployer::createDirectory(const string& name) { - string path = _variables["datadir"] + substitute(name.empty() || name[0] == '/' ? name : "/" + name); + string path = _variables["datadir"] + (name.empty() || name[0] == '/' ? name : "/" + name); _tasks.push_back(new CreateDirectory(path)); } @@ -405,35 +439,56 @@ void IcePack::ComponentDeployer::createConfigFile(const string& name) { assert(!name.empty()); - _configFile = _variables["datadir"] + substitute(name[0] == '/' ? name : "/" + name); + _configFile = _variables["datadir"] + (name[0] == '/' ? name : "/" + name); _tasks.push_back(new GenerateConfiguration(_configFile, _properties)); } void IcePack::ComponentDeployer::addProperty(const string& name, const string& value) { - _properties->setProperty(substitute(name), substitute(value)); + _properties->setProperty(name, value); } void -IcePack::ComponentDeployer::addOffer(const string& offer, const string& proxy) +IcePack::ComponentDeployer::addOffer(const string& offer, const string& adapter, const string& identity) { - if(!_yellowAdmin) + assert(!adapter.empty()); + + Yellow::AdminPrx yellowAdmin; + try { - cerr << "Yellow admin not set, can't register the offer '" << offer << "'" << endl; - _error++; - return; - } + // + // TODO: Find a better way to bootstrap the yellow service. We + // need to set the locator on the proxy here, because the + // communicator doesn't have a default locator since it's the + // locator communicator... + // + Ice::ObjectPrx object = _communicator->stringToProxy( + _communicator->getProperties()->getProperty("IcePack.Yellow.Admin")); + + if(!object) + { + cerr << "IcePack.Yellow.Admin is not set, can't register the offer '" << offer << "'" << endl; + _error++; + return; + } + + Ice::LocatorPrx locator = Ice::LocatorPrx::uncheckedCast( + _communicator->stringToProxy(_communicator->getProperties()->getProperty("Ice.Default.Locator"))); - Ice::ObjectPrx object = _communicator->stringToProxy(proxy); - if(!object) + yellowAdmin = Yellow::AdminPrx::checkedCast(object->ice_locator(locator)); + } + catch(Ice::LocalException& ex) { - cerr << "Invalid proxy: " << proxy << endl; + cerr << "Couldn't contact the yellow service to register the offer '" << offer << "':" << ex << endl; _error++; return; } + + Ice::ObjectPrx object = _communicator->stringToProxy(identity + "@" + adapter); + assert(object); - _tasks.push_back(new RegisterOffer(_yellowAdmin, offer, object)); + _tasks.push_back(new RegisterOffer(yellowAdmin, offer, object)); } // diff --git a/cpp/src/IcePack/ComponentDeployer.h b/cpp/src/IcePack/ComponentDeployer.h index df9c9b1c689..21e1ea20321 100644 --- a/cpp/src/IcePack/ComponentDeployer.h +++ b/cpp/src/IcePack/ComponentDeployer.h @@ -25,6 +25,7 @@ namespace IcePack class Task : public ::IceUtil::SimpleShared { public: + virtual void deploy() = 0; virtual void undeploy() = 0; }; @@ -50,7 +51,6 @@ public: private: ComponentDeployer& _deployer; - }; class ComponentDeployHandler : public DocumentHandler @@ -81,6 +81,7 @@ protected: private: std::stack<std::string> _elements; + std::string _adapter; ComponentDeployer& _deployer; }; @@ -100,14 +101,13 @@ public: void createDirectory(const std::string&); void createConfigFile(const std::string&); void addProperty(const std::string&, const std::string&); - void addOffer(const std::string&, const std::string&); + void addOffer(const std::string&, const std::string&, const std::string&); protected: void undeployFrom(std::vector<TaskPtr>::iterator); Ice::CommunicatorPtr _communicator; - Yellow::AdminPrx _yellowAdmin; Ice::PropertiesPtr _properties; std::map<std::string, std::string> _variables; diff --git a/cpp/src/IcePack/Makefile b/cpp/src/IcePack/Makefile index 94a62e37be0..5131a69c78f 100644 --- a/cpp/src/IcePack/Makefile +++ b/cpp/src/IcePack/Makefile @@ -69,7 +69,7 @@ $(CLIENT): $(COBJS) $(SERVER): $(SOBJS) rm -f $@ - $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(SOBJS) -lYellow -lIcePack $(XERCESC_LIBS) $(LIBS) + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $(SOBJS) -lYellow -lIcePack -lFreeze $(XERCESC_LIBS) $(LIBS) -ldb Grammar.cpp Grammar.h: Grammar.y bison -dvt Grammar.y diff --git a/cpp/src/IcePack/Parser.cpp b/cpp/src/IcePack/Parser.cpp index ee5cc1ac515..8c37e45ac4b 100644 --- a/cpp/src/IcePack/Parser.cpp +++ b/cpp/src/IcePack/Parser.cpp @@ -43,9 +43,8 @@ IcePack::Parser::usage() cout << "help Print this message.\n" "exit, quit Exit this program.\n" - "server add NAME PATH [PWD] [adapters { NAMES }] [options { OPTIONS }]\n" - " Add server NAME with PATH, optional working\n" - " directory PWD, adapters and options.\n" + "server add NAME PATH LIBRARY_PATH DESCRIPTOR\n" + " Add server NAME with PATH.\n" "server describe NAME Get server NAME description.\n" "server state NAME Get server NAME state.\n" "server start NAME Starts server NAME.\n" diff --git a/cpp/src/IcePack/Server.cpp b/cpp/src/IcePack/Server.cpp index d47775a688f..421293ec5fa 100644 --- a/cpp/src/IcePack/Server.cpp +++ b/cpp/src/IcePack/Server.cpp @@ -8,7 +8,7 @@ // // ********************************************************************** -#include <Ice/Application.h> +#include <Freeze/Application.h> #include <IcePack/LocatorI.h> #include <IcePack/LocatorRegistryI.h> #include <IcePack/ServerManagerI.h> @@ -21,16 +21,26 @@ #endif #include <util/PlatformUtils.hpp> +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> + using namespace std; using namespace Ice; +using namespace Freeze; using namespace IcePack; -class Server : public Application +class Server : public Freeze::Application { public: + Server(const string& dbEnvName) : + Freeze::Application(dbEnvName) + { + } + void usage(); - virtual int run(int, char*[]); + virtual int runFreeze(int argc, char* argv[], const DBEnvironmentPtr&); }; #ifndef _WIN32 @@ -67,7 +77,48 @@ main(int argc, char* argv[]) return EXIT_FAILURE; } - ::Server app; + // + // Get the data directory from the IcePack.Data property. + // + PropertiesPtr properties = createProperties(argc, argv); + StringSeq args = argsToStringSeq(argc, argv); + args = properties->parseCommandLineOptions("IcePack", args); + + string dataPath = properties->getProperty("IcePack.Data"); + if(dataPath.empty()) + { + cerr << argv[0] << ": property `IcePack.Data' is not set" << endl; + return EXIT_FAILURE; + } + + if(dataPath[dataPath.length() - 1] != '/') + { + dataPath += "/"; + } + + string dbPath = dataPath + "db"; + string serversPath = dataPath + "servers"; + + struct stat filestat; + if(stat(dataPath.c_str(), &filestat) == 0 && S_ISDIR(filestat.st_mode)) + { + if(stat(dbPath.c_str(), &filestat) != 0) + { + mkdir(dbPath.c_str(), 0755); + } + + if(stat(serversPath.c_str(), &filestat) != 0) + { + mkdir(serversPath.c_str(), 0755); + } + } + else + { + cerr << argv[0] << ": IcePack.Data doesn't contain a valid directory path." << endl; + return EXIT_FAILURE; + } + + ::Server app(dbPath); int rc = app.main(argc, argv); XMLPlatformUtils::Terminate(); @@ -88,12 +139,13 @@ void } int -::Server::run(int argc, char* argv[]) +::Server::runFreeze(int argc, char* argv[], const DBEnvironmentPtr& dbEnv) { PropertiesPtr properties = communicator()->getProperties(); StringSeq args = argsToStringSeq(argc, argv); args = properties->parseCommandLineOptions("IcePack", args); + args = properties->parseCommandLineOptions("Freeze", args); stringSeqToArgs(args, argc, argv); bool nowarn = false; @@ -150,42 +202,42 @@ int string adminId = properties->getPropertyWithDefault("IcePack.Admin.Identity", "IcePack/admin"); communicator()->getProperties()->setProperty("Ice.Default.Locator", locatorId + ":" + locatorEndpoints); - + // - // Register the server manager and adapter manager with an - // internal object adapter. We ensure that the internal object - // adapter doesn't have any endpoints, all the objects registered - // with this adapter are *only* accessed internally through - // collocation. + // An internal object adapter for internal objects which are not + // exposed to the outside world. They might be at one point. // ObjectAdapterPtr internalAdapter = communicator()->createObjectAdapterWithEndpoints("IcePack.Internal", ""); internalAdapter->setLocator(0); // - // Activator isn't supported on Windows yet, just pass an empty - // acticator proxy. + // Creates and register the adapter manager. // - ActivatorPrx activatorProxy; + AdapterManagerPtr adapterManager = new AdapterManagerI(internalAdapter, dbEnv); + AdapterManagerPrx adapterManagerProxy = + AdapterManagerPrx::uncheckedCast(internalAdapter->add(adapterManager, + stringToIdentity("IcePack/adaptermanager"))); + + // + // Activator and server manager are not supported on Windows yet. + // + ServerManagerPrx serverManagerProxy; #ifndef _WIN32 ActivatorIPtr activator = new ActivatorI(communicator()); activator->start(); - activatorProxy = ActivatorPrx::uncheckedCast(internalAdapter->add(activator, + ActivatorPrx activatorProxy = ActivatorPrx::uncheckedCast(internalAdapter->add(activator, stringToIdentity("IcePack/activator"))); -#endif - - AdapterManagerPtr adapterManager = new AdapterManagerI(internalAdapter); - AdapterManagerPrx adapterManagerProxy = - AdapterManagerPrx::uncheckedCast(internalAdapter->add(adapterManager, - stringToIdentity("IcePack/adaptermanager"))); - ServerManagerPtr serverManager = new ServerManagerI(internalAdapter, adapterManagerProxy, activatorProxy); - ServerManagerPrx serverManagerProxy = + ServerManagerPtr serverManager = new ServerManagerI(internalAdapter, dbEnv, adapterManagerProxy, activatorProxy); + serverManagerProxy = ServerManagerPrx::uncheckedCast(internalAdapter->add(serverManager, stringToIdentity("IcePack/servermanager"))); internalAdapter->activate(); +#endif + // // Create the "IcePack.Admin" object adapter and register the // admin object. The admin object is used by icepackadmin to diff --git a/cpp/src/IcePack/ServerDeployer.cpp b/cpp/src/IcePack/ServerDeployer.cpp index d3b7b1dd9b1..043bfb26a86 100644 --- a/cpp/src/IcePack/ServerDeployer.cpp +++ b/cpp/src/IcePack/ServerDeployer.cpp @@ -27,9 +27,8 @@ class AddAdapterTask : public Task { public: - AddAdapterTask(const AdapterManagerPrx& manager, const ServerPtr& server, const AdapterDescription& desc) : + AddAdapterTask(const AdapterManagerPrx& manager, const AdapterDescription& desc) : _manager(manager), - _server(server), _desc(desc) { } @@ -39,10 +38,7 @@ public: { try { - AdapterPrx adapter = _manager->create(_desc); - - _server->_description.adapters.push_back(_desc.name); - _server->_adapters.push_back(adapter); + AdapterPrx adapter = _manager->create(_desc); } catch(const AdapterExistsException&) { @@ -54,18 +50,11 @@ public: undeploy() { _manager->remove(_desc.name); - - // - // NOTE: We don't need to remove the adapter from the - // server. The undo occured because a problem during the - // server deployment so the server will be removed anyway. - // } private: AdapterManagerPrx _manager; - ServerPtr _server; AdapterDescription _desc; }; @@ -78,8 +67,8 @@ public: ServerDeployHandler(ServerDeployer&); - virtual void startElement(const XMLCh *const name, AttributeList &attrs); - virtual void endElement(const XMLCh *const name); + virtual void startElement(const XMLCh *const, AttributeList &); + virtual void endElement(const XMLCh *const); virtual void startDocument(); private: @@ -117,22 +106,27 @@ IcePack::ServerDeployHandler::startElement(const XMLCh *const name, AttributeLis string kind = getAttributeValue(attrs, "kind"); if(kind == "cpp") { - _deployer.setKind(ServerDeployer::CppServer); + _deployer.setKind(ServerDeployer::ServerKindCppServer); + _deployer.createConfigFile("/config/config_server"); } else if(kind == "java") { - _deployer.setKind(ServerDeployer::JavaServer); + _deployer.setKind(ServerDeployer::ServerKindJavaServer); + _deployer.createConfigFile("/config/config_server"); } else if(kind == "cpp-icebox") { - _deployer.setKind(ServerDeployer::CppIceBox); + _deployer.setKind(ServerDeployer::ServerKindCppIceBox); + _deployer.addProperty("IceBox.ServiceManager.Endpoints", getAttributeValue(attrs, "endpoints")); + _deployer.createConfigFile("/config/config_icebox"); } else if(kind == "java-icebox") { - _deployer.setKind(ServerDeployer::JavaIceBox); + _deployer.setKind(ServerDeployer::ServerKindJavaIceBox); + _deployer.addProperty("IceBox.ServiceManager.Endpoints", getAttributeValue(attrs, "endpoints")); + _deployer.createConfigFile("/config/config_icebox"); } - _deployer.createConfigFile("/config/config_server"); } else if(str == "service") { @@ -142,7 +136,7 @@ IcePack::ServerDeployHandler::startElement(const XMLCh *const name, AttributeLis } else if(str == "adapter") { - _deployer.addAdapter(getAttributeValue(attrs, "name")); + _deployer.addAdapter(getAttributeValue(attrs, "name"), getAttributeValueWithDefault(attrs, "endpoints", "")); } } @@ -164,14 +158,17 @@ IcePack::ServerDeployHandler::endElement(const XMLCh *const name) } IcePack::ServerDeployer::ServerDeployer(const Ice::CommunicatorPtr& communicator, - const ServerPtr& server, - const ServerPrx& serverProxy) : + const string& name, + const string& path, + const string& libraryPath) : ComponentDeployer(communicator), - _server(server), - _serverProxy(serverProxy) + _libraryPath(libraryPath) { - _variables["name"] = _server->_description.name; + _variables["name"] = name; _variables["datadir"] += "/" + _variables["name"]; + + _description.name = name; + _description.path = path; } void @@ -181,51 +178,78 @@ IcePack::ServerDeployer::setAdapterManager(const AdapterManagerPrx& manager) } void -IcePack::ServerDeployer::parse() +IcePack::ServerDeployer::setServerManager(const ServerManagerPrx& manager) +{ + _serverManager = manager; +} + +void +IcePack::ServerDeployer::parse(const std::string& descriptor) { ServerDeployHandler handler(*this); - ComponentDeployer::parse(_server->_description.descriptor, handler); + // + // Parse the deployment descriptor. + // + ComponentDeployer::parse(descriptor, handler); // // Once everything is parsed, we can perform some final setup // before the deployment starts. // + _description.descriptor = descriptor; + Ice::PropertiesPtr props = _communicator->getProperties(); _properties->setProperty("Ice.ProgramName", _variables["name"]); _properties->setProperty("Ice.Default.Locator", props->getProperty("Ice.Default.Locator")); _properties->setProperty("Yellow.Query", props->getProperty("IcePack.Yellow.Query")); - if(_kind == JavaServer) + if(_kind == ServerKindJavaServer) { - if(!_server->_description.libraryPath.empty()) + if(!_libraryPath.empty()) { _javaOptions.push_back("-classpath"); - _javaOptions.push_back(_server->_description.libraryPath); + _javaOptions.push_back(_libraryPath); _javaOptions.push_back("-ea"); } _javaOptions.push_back(_className); for(vector<string>::reverse_iterator p = _javaOptions.rbegin(); p != _javaOptions.rend(); ++p) { - _server->_description.args.insert(_server->_description.args.begin(), *p); + _description.args.insert(_description.args.begin(), *p); } } - _server->_description.args.push_back("--Ice.Config=" + _configFile); + _description.args.push_back("--Ice.Config=" + _configFile); +} + +void +IcePack::ServerDeployer::deploy() +{ + ComponentDeployer::deploy(); + + _serverManager->create(_description); +} + +void +IcePack::ServerDeployer::undeploy() +{ + _serverManager->remove(_description.name); + + ComponentDeployer::undeploy(); } void IcePack::ServerDeployer::setClassName(const string& name) { - if(_kind != JavaServer) + if(_kind != ServerKindJavaServer) { cerr << "Class name element only allowed for Java servers." << endl; _error++; return; } - if(name == "") + if(name.empty()) { cerr << "Empty path." << endl; _error++; @@ -238,18 +262,18 @@ IcePack::ServerDeployer::setClassName(const string& name) void IcePack::ServerDeployer::setWorkingDirectory(const string& pwd) { - if(pwd == "") + if(pwd.empty()) { cerr << "Empty working directory." << endl; _error++; return; } - _server->_description.pwd = substitute(pwd); + _description.pwd = pwd; } void -IcePack::ServerDeployer::addAdapter(const string& name) +IcePack::ServerDeployer::addAdapter(const string& name, const string& endpoints) { if(!_adapterManager) { @@ -259,8 +283,9 @@ IcePack::ServerDeployer::addAdapter(const string& name) } AdapterDescription desc; - desc.name = substitute(name); - desc.server = _serverProxy; + desc.name = name; + desc.server = ServerPrx::uncheckedCast( + _communicator->stringToProxy("server/" + _description.name + "@IcePack.Internal")); if(desc.name == "") { cerr << "Empty adapter name." << endl; @@ -268,32 +293,51 @@ IcePack::ServerDeployer::addAdapter(const string& name) return; } - _tasks.push_back(new AddAdapterTask(_adapterManager, _server, desc)); + _tasks.push_back(new AddAdapterTask(_adapterManager, desc)); + + _description.adapters.push_back(desc.name); + + if(!endpoints.empty()) + { + addProperty("Ice.Adapter." + name + ".Endpoints", endpoints); + } } void IcePack::ServerDeployer::addService(const string& name, const string& descriptor) { - if(_kind != CppIceBox && _kind != JavaIceBox) + if(_kind != ServerKindCppIceBox && _kind != ServerKindJavaIceBox) { cerr << "Service elements are only allowed for Java or C++ IceBox servers." << endl; _error++; return; } + if(name.empty() || descriptor.empty()) + { + cerr << "Name or descriptor attribute value is empty in service element." << endl; + _error++; + return; + } + + // + // Setup new variables for the service, overides the name value. + // std::map<std::string, std::string> variables = _variables; variables["name"] = name; ServiceDeployer* task = new ServiceDeployer(_communicator, *this, variables); try { - task->parse(descriptor); + string xmlFile = descriptor[0] != '/' ? _variables["basedir"] + "/" + descriptor : descriptor; + task->parse(xmlFile); } catch(const DeploymentException&) { cerr << "Failed to parse the service '" << name << "' descriptor" << endl; delete task; _error++; + return; } _tasks.push_back(task); @@ -302,13 +346,13 @@ IcePack::ServerDeployer::addService(const string& name, const string& descriptor void IcePack::ServerDeployer::addOption(const string& option) { - _server->_description.args.push_back(substitute(option)); + _description.args.push_back(option); } void IcePack::ServerDeployer::addJavaOption(const string& option) { - _javaOptions.push_back(substitute(option)); + _javaOptions.push_back(option); } void @@ -316,37 +360,39 @@ IcePack::ServerDeployer::setKind(ServerDeployer::ServerKind kind) { switch(kind) { - case CppServer: - if(_server->_description.path.empty()) + case ServerKindCppServer: + if(_description.path.empty()) { cerr << "C++ server path is not specified" << endl; _error++; break; } - case JavaServer: - if(_server->_description.path.empty()) + case ServerKindJavaServer: + if(_description.path.empty()) { - _server->_description.path = "java"; + _description.path = "java"; } break; - case JavaIceBox: - if(_server->_description.path.empty()) + case ServerKindJavaIceBox: + if(_description.path.empty()) { - _server->_description.path = "java"; + _description.path = "java"; } - addProperty("IceBox.Name", "${name}"); - addAdapter("${name}.ServiceManagerAdapter"); + createDirectory("/dbs"); + addProperty("IceBox.Name", _variables["name"]); + addAdapter(_variables["name"] + ".ServiceManagerAdapter",""); break; - case CppIceBox: - if(_server->_description.path.empty()) + case ServerKindCppIceBox: + if(_description.path.empty()) { - _server->_description.path = "icebox"; + _description.path = "icebox"; } - addProperty("IceBox.Name", "${name}"); - addAdapter("${name}.ServiceManagerAdapter"); + createDirectory("/dbs"); + addProperty("IceBox.Name", _variables["name"]); + addAdapter(_variables["name"] + ".ServiceManagerAdapter",""); break; } diff --git a/cpp/src/IcePack/ServerDeployer.h b/cpp/src/IcePack/ServerDeployer.h index 3e93a4b720a..c2004d06bc3 100644 --- a/cpp/src/IcePack/ServerDeployer.h +++ b/cpp/src/IcePack/ServerDeployer.h @@ -14,6 +14,7 @@ #include <IceUtil/Shared.h> #include <IcePack/ComponentDeployer.h> +#include <IcePack/Admin.h> #include <IcePack/ServerManagerF.h> #include <IcePack/AdapterManagerF.h> @@ -23,23 +24,30 @@ namespace IcePack class ServerDeployer : public ComponentDeployer { public: + enum ServerKind { - CppIceBox, - JavaIceBox, - CppServer, - JavaServer + ServerKindCppIceBox, + ServerKindJavaIceBox, + ServerKindCppServer, + ServerKindJavaServer }; - ServerDeployer(const Ice::CommunicatorPtr&, const ServerPtr&, const ServerPrx&); + ServerDeployer(const Ice::CommunicatorPtr&, const std::string&, const std::string&, const std::string&); + void setServerManager(const ServerManagerPrx&); void setAdapterManager(const AdapterManagerPrx&); - virtual void parse(); + void parse(const std::string&); + + virtual void deploy(); + virtual void undeploy(); + + const ServerDescription& getServerDescription() const; void setClassName(const std::string&); void setWorkingDirectory(const std::string&); - void addAdapter(const std::string&); + void addAdapter(const std::string&, const std::string&); void addService(const std::string&, const std::string&); void addOption(const std::string&); void addJavaOption(const std::string&); @@ -47,14 +55,13 @@ public: private: + ServerManagerPrx _serverManager; AdapterManagerPrx _adapterManager; ServerKind _kind; - - ServerPtr _server; - ServerPrx _serverProxy; - + ServerDescription _description; std::string _className; + std::string _libraryPath; std::vector<std::string> _javaOptions; }; diff --git a/cpp/src/IcePack/ServerManager.ice b/cpp/src/IcePack/ServerManager.ice index 3a3db9e9981..577b376beb8 100644 --- a/cpp/src/IcePack/ServerManager.ice +++ b/cpp/src/IcePack/ServerManager.ice @@ -58,7 +58,8 @@ class Server * Set the server state. * **/ - void setState(ServerState state); + void setState(ServerState state) + throws ServerNotInactiveException; /** * @@ -69,13 +70,6 @@ class Server /** * - * The server state. - * - */ - ServerState _state; - - /** - * * The adapter proxies. * **/ @@ -89,7 +83,7 @@ class ServerManager * Create a server. * **/ - Server* create(string name, string path, string libpath, string descriptor) + Server* create(ServerDescription desc) throws DeploymentException, ServerExistsException; /** diff --git a/cpp/src/IcePack/ServerManagerI.cpp b/cpp/src/IcePack/ServerManagerI.cpp index a9ec5b768c4..890d73c582b 100644 --- a/cpp/src/IcePack/ServerManagerI.cpp +++ b/cpp/src/IcePack/ServerManagerI.cpp @@ -9,6 +9,8 @@ // ********************************************************************** #include <Ice/Ice.h> +#include <Freeze/DB.h> +#include <Freeze/Evictor.h> #include <Ice/Functional.h> #include <Ice/LoggerUtil.h> #include <IcePack/ServerManagerI.h> @@ -46,11 +48,45 @@ private: ObjectAdapterPtr _adapter; }; +class ServerFactory : public ObjectFactory +{ +public: + + ServerFactory(const ObjectAdapterPtr& adapter, const ActivatorPrx& activator) : + _adapter(adapter), + _activator(activator) + { + } + + // + // Operations from ObjectFactory + // + virtual Ice::ObjectPtr + create(const std::string& type) + { + assert(type == "::IcePack::Server"); + return new ServerI(_adapter, _activator); + } + + virtual void + destroy() + { + _adapter = 0; + _activator = 0; + } + +private: + + ObjectAdapterPtr _adapter; + ActivatorPrx _activator; +}; + } IcePack::ServerI::ServerI(const ObjectAdapterPtr& adapter, const ActivatorPrx& activator) : _adapter(adapter), - _activator(activator) + _activator(activator), + _state(Inactive) { } @@ -155,13 +191,34 @@ IcePack::ServerI::setState(ServerState state, const Current&) notifyAll(); } -IcePack::ServerManagerI::ServerManagerI(const ObjectAdapterPtr& adapter, +IcePack::ServerManagerI::ServerManagerI(const ObjectAdapterPtr& adapter, + const Freeze::DBEnvironmentPtr& dbEnv, const AdapterManagerPrx& adapterManager, const ActivatorPrx& activator) : _adapter(adapter), _adapterManager(adapterManager), _activator(activator) { + ObjectFactoryPtr serverFactory = new ServerFactory(adapter, activator); + adapter->getCommunicator()->addObjectFactory(serverFactory, "::IcePack::Server"); + + Freeze::DBPtr dbServers = dbEnv->openDB("servers", true); + _evictor = dbServers->createEvictor(Freeze::SaveUponEviction); + _evictor->setSize(100); + _adapter->addServantLocator(_evictor, "server"); + + // + // Cache the server names for getAll(). This will load all the + // server objects at the begining and might cause slow startup. + // + Freeze::EvictorIteratorPtr p = _evictor->getIterator(); + while(p->hasNext()) + { + ServerPrx s = ServerPrx::checkedCast(_adapter->createProxy(p->next())); + assert(s); + ServerDescription desc = s->getServerDescription(); + _serverNames.insert(desc.name); + } } IcePack::ServerManagerI::~ServerManagerI() @@ -169,12 +226,11 @@ IcePack::ServerManagerI::~ServerManagerI() } ServerPrx -IcePack::ServerManagerI::create(const string& name, const string& path, const string& libraryPath, - const string& descriptor, const Current&) +IcePack::ServerManagerI::create(const ServerDescription& desc, const Current&) { IceUtil::Mutex::Lock sync(*this); - ServerPrx server = ServerNameToServer(_adapter)(name); + ServerPrx server = ServerNameToServer(_adapter)(desc.name); try { server->ice_ping(); @@ -183,48 +239,18 @@ IcePack::ServerManagerI::create(const string& name, const string& path, const st catch (const ObjectNotExistException&) { } - - // - // Creates the server. Set its state to Activating so that we can - // safelly register the adapters without any race conditions. If a - // request comes in for an adapter we've just registerd, the - // server won't be started as long as we are not in the Inactive - // state. - // - // TODO: the server isn't fully initialized here. Is this really - // valid to add the servant to the object adapter? If not, how do - // we handle the race condition because of registered adapters - // having a proxy on the server? - // + ServerPtr serverI = new ServerI(_adapter, _activator); - serverI->_description.name = name; - serverI->_description.path = path; - serverI->_description.libraryPath = libraryPath; - serverI->_description.descriptor = descriptor; - serverI->_state = Activating; - server = ServerPrx::uncheckedCast(_adapter->add(serverI, server->ice_getIdentity())); - - // - // Deploy the server. - // - try - { - ServerDeployer deployer(_adapter->getCommunicator(), serverI, server); - deployer.setAdapterManager(_adapterManager); - - deployer.parse(); - deployer.deploy(); - } - catch(const DeploymentException&) + serverI->_description = desc; + for(AdapterNames::const_iterator p = desc.adapters.begin(); p != desc.adapters.end(); ++p) { - _adapter->remove(server->ice_getIdentity()); - serverI->setState(Destroyed); - throw; + AdapterPrx adapter = _adapterManager->findByName(*p); + serverI->_adapters.push_back(adapter); } - serverI->setState(Inactive); + _evictor->createObject(server->ice_getIdentity(), serverI); - _serverNames.insert(name); + _serverNames.insert(desc.name); return server; } @@ -260,34 +286,9 @@ IcePack::ServerManagerI::remove(const string& name, const Current&) { throw ServerNotExistException(); } - - // - // Mark the server as destroyed. - // - ServerPtr serverI = ServerPtr::dynamicCast(_adapter->proxyToServant(server).get()); - assert(serverI); - serverI->setState(Destroyed); - - // - // Undeploy the server. - // - try - { - ServerDeployer deployer(_adapter->getCommunicator(), serverI, server); - deployer.setAdapterManager(_adapterManager); - - deployer.parse(); - deployer.undeploy(); - } - catch(const DeploymentException& ex) - { - } - _adapter->remove(server->ice_getIdentity()); + _evictor->destroyObject(server->ice_getIdentity()); - // - // Remove the server name from our internal server name set. - // _serverNames.erase(_serverNames.find(name)); } diff --git a/cpp/src/IcePack/ServerManagerI.h b/cpp/src/IcePack/ServerManagerI.h index b5262e05634..9ee4105c56d 100644 --- a/cpp/src/IcePack/ServerManagerI.h +++ b/cpp/src/IcePack/ServerManagerI.h @@ -12,6 +12,7 @@ #define ICE_PACK_SERVER_MANAGER_I_H #include <IceUtil/Mutex.h> +#include <Freeze/DB.h> #include <IcePack/ServerManager.h> #include <IcePack/Activator.h> #include <set> @@ -36,6 +37,8 @@ private: ::Ice::ObjectAdapterPtr _adapter; ActivatorPrx _activator; + + ServerState _state; }; @@ -43,11 +46,11 @@ class ServerManagerI : public ServerManager, public IceUtil::Mutex { public: - ServerManagerI(const Ice::ObjectAdapterPtr&, const AdapterManagerPrx&, const ActivatorPrx&); + ServerManagerI(const Ice::ObjectAdapterPtr&, const Freeze::DBEnvironmentPtr&, const AdapterManagerPrx&, + const ActivatorPrx&); virtual ~ServerManagerI(); - virtual ServerPrx create(const std::string&, const std::string&, const std::string&, const std::string&, - const ::Ice::Current&); + virtual ServerPrx create(const ServerDescription&, const ::Ice::Current&); virtual ServerPrx findByName(const ::std::string&, const ::Ice::Current&); virtual void remove(const ::std::string&, const ::Ice::Current&); virtual ServerNames getAll(const ::Ice::Current&); @@ -55,6 +58,7 @@ public: private: ::Ice::ObjectAdapterPtr _adapter; + ::Freeze::EvictorPtr _evictor; ::std::set< ::std::string> _serverNames; AdapterManagerPrx _adapterManager; ActivatorPrx _activator; diff --git a/cpp/src/IcePack/ServiceDeployer.cpp b/cpp/src/IcePack/ServiceDeployer.cpp index 5c70c9391a8..38ac5917678 100644 --- a/cpp/src/IcePack/ServiceDeployer.cpp +++ b/cpp/src/IcePack/ServiceDeployer.cpp @@ -58,22 +58,21 @@ IcePack::ServiceDeployHandler::startElement(const XMLCh *const name, AttributeLi string kind = getAttributeValue(attrs, "kind"); if(kind == "standard") { - _deployer.setKind(ServiceDeployer::Standard); + _deployer.setKind(ServiceDeployer::ServiceKindStandard); } else if(kind == "freeze") { - _deployer.setKind(ServiceDeployer::Freeze); + _deployer.setKind(ServiceDeployer::ServiceKindFreeze); _deployer.setDBEnv(getAttributeValueWithDefault(attrs, "dbenv", "${name}")); } - _deployer.setEntryPoint(getAttributeValueWithDefault(attrs, "library", "${name}"), - getAttributeValueWithDefault(attrs, "entry", "create")); - - _deployer.createConfigFile("/config/config_${name}"); + _deployer.createConfigFile("/config/config_" + _deployer.substitute("${name}")); + _deployer.setEntryPoint(getAttributeValue(attrs, "entry")); } else if(str == "adapter") { - _deployer.getServerDeployer().addAdapter(getAttributeValue(attrs, "name")); + _deployer.getServerDeployer().addAdapter(getAttributeValue(attrs, "name"), + getAttributeValueWithDefault(attrs, "endpoints", "")); } } @@ -115,10 +114,10 @@ IcePack::ServiceDeployer::setKind(ServiceKind kind) } void -IcePack::ServiceDeployer::setEntryPoint(const string& library, const string& entry) +IcePack::ServiceDeployer::setEntryPoint(const string& entry) { assert(!_configFile.empty()); - _serverDeployer.addProperty("IceBox.Service.${name}", library + ":" + entry + " --Ice.Config=" + _configFile); + _serverDeployer.addProperty("IceBox.Service." + _variables["name"], entry + " --Ice.Config=" + _configFile); } void @@ -126,14 +125,15 @@ IcePack::ServiceDeployer::setDBEnv(const string& dir) { assert(!dir.empty()); - if(_kind != Freeze) + if(_kind != ServiceKindFreeze) { - cerr << "Dabase environment is only allowed for Freeze services." << endl; + cerr << "Database environment is only allowed for Freeze services." << endl; _error++; return; } createDirectory("/dbs" + (dir[0] == '/' ? dir : "/" + dir)); - addProperty("IceBox.DBEnvName.${name}", "${datadir}/dbs" + (dir[0] == '/' ? dir : "/" + dir)); + addProperty("IceBox.DBEnvName." + _variables["name"], + _variables["datadir"] + "/dbs" + (dir[0] == '/' ? dir : "/" + dir)); } diff --git a/cpp/src/IcePack/ServiceDeployer.h b/cpp/src/IcePack/ServiceDeployer.h index 6a645ca3416..6895d868585 100644 --- a/cpp/src/IcePack/ServiceDeployer.h +++ b/cpp/src/IcePack/ServiceDeployer.h @@ -25,8 +25,8 @@ public: enum ServiceKind { - Standard, - Freeze + ServiceKindStandard, + ServiceKindFreeze }; ServiceDeployer(const Ice::CommunicatorPtr&, ServerDeployer&, const std::map<std::string, std::string>&); @@ -36,7 +36,7 @@ public: ServerDeployer& getServerDeployer() const; void setKind(ServiceKind); - void setEntryPoint(const std::string&, const std::string&); + void setEntryPoint(const std::string&); void setDBEnv(const std::string&); private: |