diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/IcePatch/.depend | 6 | ||||
-rw-r--r-- | cpp/src/IcePatch/Client.cpp | 5 | ||||
-rw-r--r-- | cpp/src/IcePatch/Makefile | 2 | ||||
-rw-r--r-- | cpp/src/IcePatch/NodeI.cpp | 110 | ||||
-rw-r--r-- | cpp/src/IcePatch/NodeI.h | 2 | ||||
-rw-r--r-- | cpp/src/IcePatch/NodeLocator.cpp | 7 | ||||
-rw-r--r-- | cpp/src/IcePatch/Util.cpp (renamed from cpp/src/IcePatch/NodeUtil.cpp) | 83 | ||||
-rw-r--r-- | cpp/src/IcePatch/Util.h (renamed from cpp/src/IcePatch/NodeUtil.h) | 10 |
8 files changed, 116 insertions, 109 deletions
diff --git a/cpp/src/IcePatch/.depend b/cpp/src/IcePatch/.depend index b7d05a268e6..78294f2efe8 100644 --- a/cpp/src/IcePatch/.depend +++ b/cpp/src/IcePatch/.depend @@ -1,7 +1,7 @@ Node.o: Node.cpp ../../include/Ice/Stream.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/BuiltinSequences.h ../../include/IcePatch/Node.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/InstanceF.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/ObjectFactory.h -NodeUtil.o: NodeUtil.cpp ../IcePatch/NodeUtil.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/SystemF.h ../../include/Ice/SslExtensionF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/IcePatch/Node.h -Client.o: Client.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/SystemF.h ../../include/Ice/SslExtensionF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePatch/NodeDescFactory.h ../../include/IcePatch/Node.h ../IcePatch/NodeUtil.h +Util.o: Util.cpp ../IcePatch/Util.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/SystemF.h ../../include/Ice/SslExtensionF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/IcePatch/Node.h +Client.o: Client.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/SystemF.h ../../include/Ice/SslExtensionF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePatch/NodeDescFactory.h ../../include/IcePatch/Node.h ../IcePatch/Util.h NodeDescFactory.o: NodeDescFactory.cpp ../IcePatch/NodeDescFactory.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/SystemF.h ../../include/Ice/SslExtensionF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/IcePatch/Node.h Server.o: Server.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/SystemF.h ../../include/Ice/SslExtensionF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../IcePatch/NodeLocator.h ../IcePatch/NodeI.h ../../include/IcePatch/Node.h -NodeI.o: NodeI.cpp ../IcePatch/NodeI.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/SystemF.h ../../include/Ice/SslExtensionF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/IcePatch/Node.h ../IcePatch/NodeUtil.h +NodeI.o: NodeI.cpp ../IcePatch/NodeI.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/SystemF.h ../../include/Ice/SslExtensionF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/IcePatch/Node.h ../IcePatch/Util.h NodeLocator.o: NodeLocator.cpp ../IcePatch/NodeLocator.h ../IcePatch/NodeI.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/ObjectFactoryF.h ../../include/Ice/LocalObject.h ../../include/IceUtil/Shared.h ../../include/Ice/StreamF.h ../../include/Ice/PropertiesF.h ../../include/Ice/InstanceF.h ../../include/Ice/Properties.h ../../include/Ice/BuiltinSequences.h ../../include/Ice/Logger.h ../../include/Ice/LoggerUtil.h ../../include/Ice/LoggerF.h ../../include/Ice/Communicator.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/Object.h ../../include/Ice/Outgoing.h ../../include/IceUtil/Monitor.h ../../include/IceUtil/Cond.h ../../include/Ice/BasicStream.h ../../include/Ice/Buffer.h ../../include/Ice/Incoming.h ../../include/Ice/Direct.h ../../include/Ice/ServantLocatorF.h ../../include/Ice/UserExceptionFactoryF.h ../../include/Ice/RouterF.h ../../include/Ice/SystemF.h ../../include/Ice/SslExtensionF.h ../../include/Ice/ObjectFactory.h ../../include/Ice/UserExceptionFactory.h ../../include/Ice/ObjectAdapter.h ../../include/Ice/ServantLocator.h ../../include/Ice/IdentityUtil.h ../../include/IcePatch/Node.h diff --git a/cpp/src/IcePatch/Client.cpp b/cpp/src/IcePatch/Client.cpp index 4af72481f07..2cb7144c3b3 100644 --- a/cpp/src/IcePatch/Client.cpp +++ b/cpp/src/IcePatch/Client.cpp @@ -10,7 +10,7 @@ #include <Ice/Application.h> #include <IcePatch/NodeDescFactory.h> -#include <IcePatch/NodeUtil.h> +#include <IcePatch/Util.h> using namespace std; using namespace Ice; @@ -104,7 +104,8 @@ IcePatch::Client::run(int argc, char* argv[]) // // Display node structure. // - ObjectPrx topObj = communicator()->stringToProxy("IcePatch/.:" + endpoints); + Identity identity = pathToIdentity("."); + ObjectPrx topObj = communicator()->stringToProxy(identityToString(identity) + ':' + endpoints); NodePrx top = NodePrx::checkedCast(topObj); printNodeDesc(top->describe()); } diff --git a/cpp/src/IcePatch/Makefile b/cpp/src/IcePatch/Makefile index 1f377f7c427..1036def7f0d 100644 --- a/cpp/src/IcePatch/Makefile +++ b/cpp/src/IcePatch/Makefile @@ -16,7 +16,7 @@ SERVER = $(top_srcdir)/bin/icepatch TARGETS = $(CLIENT) $(SERVER) OBJS = Node.o \ - NodeUtil.o + Util.o COBJS = Client.o \ NodeDescFactory.o diff --git a/cpp/src/IcePatch/NodeI.cpp b/cpp/src/IcePatch/NodeI.cpp index d0c8635b456..ed3c3a11947 100644 --- a/cpp/src/IcePatch/NodeI.cpp +++ b/cpp/src/IcePatch/NodeI.cpp @@ -9,8 +9,7 @@ // ********************************************************************** #include <IcePatch/NodeI.h> -#include <IcePatch/NodeUtil.h> -#include <dirent.h> +#include <IcePatch/Util.h> using namespace std; using namespace Ice; @@ -21,36 +20,6 @@ IcePatch::NodeI::NodeI(const ObjectAdapterPtr& adapter) : { } -string -IcePatch::NodeI::normalizePath(const string& path) -{ - string result = path; - - string::size_type pos; - - for (pos = 0; pos < result.size(); ++pos) - { - if (result[pos] == '\\') - { - result[pos] = '/'; - } - } - - pos = 0; - while ((pos = result.find("//", pos)) != string::npos) - { - result.erase(pos, 1); - } - - pos = 0; - while ((pos = result.find("/./", pos)) != string::npos) - { - result.erase(pos, 2); - } - - return result; -} - IcePatch::DirectoryI::DirectoryI(const ObjectAdapterPtr& adapter) : NodeI(adapter) { @@ -67,76 +36,35 @@ IcePatch::DirectoryI::describe(const Ice::Current& current) NodeDescSeq IcePatch::DirectoryI::getContents(const Ice::Current& current) { - string path = normalizePath(current.identity.name); - - struct dirent **namelist; - int n = scandir(path.c_str(), &namelist, 0, alphasort); - if (n < 0) - { - NodeAccessException ex; - ex.reason = "cannot read directory `" + path + "':" + strerror(errno); - throw ex; - } + StringSeq paths = readDirectory(identityToPath(current.identity)); NodeDescSeq result; - result.reserve(n - 2); + result.reserve(paths.size()); - int i; - - try + StringSeq::const_iterator p; + for (p = paths.begin(); p != paths.end(); ++p) { - Identity identity; - identity.category = "IcePatch"; - - for (i = 0; i < n; ++i) + string::size_type pos; + if ((pos = p->rfind(".md5")) != string::npos) { - string name = namelist[i]->d_name; - - if (name == ".." || name == ".") + if (p->size() == pos + 4) { continue; } - - string::size_type pos; - if ((pos = name.rfind(".md5")) != string::npos) - { - if (name.size() == pos + 4) - { - continue; - } - } - - identity.name = path + '/' + name; - NodePrx node = NodePrx::uncheckedCast(_adapter->createProxy(identity)); - try - { - result.push_back(node->describe()); - } - catch (const ObjectNotExistException&) - { - // - // Ignore. This can for example happen if the node - // locator cannot call stat() on the file. - // - } } - - for (i = 0; i < n; ++i) + + NodePrx node = NodePrx::uncheckedCast(_adapter->createProxy(pathToIdentity(*p))); + try { - free(namelist[i]); + result.push_back(node->describe()); } - free(namelist); - - } - catch (...) - { - for (i = 0; i < n; ++i) + catch (const ObjectNotExistException&) { - free(namelist[i]); + // + // Ignore. This can for example happen if the node + // locator cannot call stat() on the file. + // } - free(namelist); - - throw; } return result; @@ -152,14 +80,12 @@ IcePatch::FileI::describe(const Ice::Current& current) { FileDescPtr desc = new FileDesc; desc->file = FilePrx::uncheckedCast(_adapter->createProxy(current.identity)); - string path = normalizePath(current.identity.name); - desc->md5 = getMD5(path); + desc->md5 = getMD5(identityToPath(current.identity)); return desc; } ByteSeq IcePatch::FileI::getBytes(Int startPos, Int howMuch, const Ice::Current& current) { - string path = normalizePath(current.identity.name); return ByteSeq(); } diff --git a/cpp/src/IcePatch/NodeI.h b/cpp/src/IcePatch/NodeI.h index 4f5e73a6b9c..57d53e30d55 100644 --- a/cpp/src/IcePatch/NodeI.h +++ b/cpp/src/IcePatch/NodeI.h @@ -23,8 +23,6 @@ public: NodeI(const Ice::ObjectAdapterPtr&); - static std::string normalizePath(const std::string&); - protected: Ice::ObjectAdapterPtr _adapter; diff --git a/cpp/src/IcePatch/NodeLocator.cpp b/cpp/src/IcePatch/NodeLocator.cpp index 98c8d6c8ccf..2785115693e 100644 --- a/cpp/src/IcePatch/NodeLocator.cpp +++ b/cpp/src/IcePatch/NodeLocator.cpp @@ -9,6 +9,7 @@ // ********************************************************************** #include <IcePatch/NodeLocator.h> +#include <IcePatch/Util.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> @@ -26,12 +27,10 @@ IcePatch::NodeLocator::NodeLocator(const Ice::ObjectAdapterPtr& adapter) : ObjectPtr IcePatch::NodeLocator::locate(const ObjectAdapterPtr&, const Current& current, LocalObjectPtr&) { - assert(current.identity.category == "IcePatch"); - // - // Check whether the path (= identity.name) is valid. + // Check whether the path is valid. // - string path = current.identity.name; + string path = identityToPath(current.identity); if (path.empty()) { diff --git a/cpp/src/IcePatch/NodeUtil.cpp b/cpp/src/IcePatch/Util.cpp index 046f98c1afb..f2191e462fe 100644 --- a/cpp/src/IcePatch/NodeUtil.cpp +++ b/cpp/src/IcePatch/Util.cpp @@ -8,17 +8,96 @@ // // ********************************************************************** -#include <IcePatch/NodeUtil.h> +#include <IcePatch/Util.h> +#include <IcePatch/Node.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> +#include <dirent.h> #include <openssl/md5.h> using namespace std; using namespace Ice; using namespace IcePatch; +static string +normalizePath(const string& path) +{ + string result = path; + + string::size_type pos; + + for (pos = 0; pos < result.size(); ++pos) + { + if (result[pos] == '\\') + { + result[pos] = '/'; + } + } + + pos = 0; + while ((pos = result.find("//", pos)) != string::npos) + { + result.erase(pos, 1); + } + + pos = 0; + while ((pos = result.find("/./", pos)) != string::npos) + { + result.erase(pos, 2); + } + + return result; +} + +string +IcePatch::identityToPath(const Identity& identity) +{ + assert(identity.category == "IcePatch"); + return normalizePath(identity.name); +} + +Identity +IcePatch::pathToIdentity(const string& path) +{ + Identity identity; + identity.category = "IcePatch"; + identity.name = normalizePath(path); + return identity; +} + +StringSeq +IcePatch::readDirectory(const string& path) +{ + struct dirent **namelist; + int n = scandir(path.c_str(), &namelist, 0, alphasort); + if (n < 0) + { + NodeAccessException ex; + ex.reason = "cannot read directory `" + path + "':" + strerror(errno); + throw ex; + } + + StringSeq result; + result.reserve(n - 2); + + for (int i = 0; i < n; ++i) + { + string name = namelist[i]->d_name; + + free(namelist[i]); + + if (name != ".." && name != ".") + { + result.push_back(path + '/' + name); + } + } + + free(namelist); + return result; +} + ByteSeq IcePatch::getMD5(const std::string& path) { @@ -137,7 +216,7 @@ IcePatch::getMD5(const std::string& path) // Write the MD5 hash value to the corresponding .md5 file. // { - int fd = open(pathmd5.c_str(), O_WRONLY | O_CREAT); + int fd = open(pathmd5.c_str(), O_WRONLY | O_CREAT, 00644); if (fd == -1) { diff --git a/cpp/src/IcePatch/NodeUtil.h b/cpp/src/IcePatch/Util.h index f2de80252b2..2f2c65d6596 100644 --- a/cpp/src/IcePatch/NodeUtil.h +++ b/cpp/src/IcePatch/Util.h @@ -8,15 +8,19 @@ // // ********************************************************************** -#ifndef ICE_PATCH_NODE_UTIL_H -#define ICE_PATCH_NODE_UTIL_H +#ifndef ICE_PATCH_UTIL_H +#define ICE_PATCH_UTIL_H #include <Ice/Ice.h> -#include <IcePatch/Node.h> namespace IcePatch { +std::string identityToPath(const Ice::Identity&); +Ice::Identity pathToIdentity(const std::string&); + +Ice::StringSeq readDirectory(const std::string&); + Ice::ByteSeq getMD5(const std::string&); std::string MD5ToString(const Ice::ByteSeq&); |