diff options
author | Marc Laukien <marc@zeroc.com> | 2002-04-04 04:27:08 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-04-04 04:27:08 +0000 |
commit | 30782d480a0f5f732175dd22f49b56a013eb5fe6 (patch) | |
tree | b21d673e83ed0a6d48bfef34a32a9b7e73835992 /cpp/src/IcePatch/Client.cpp | |
parent | more IcePatch stuff (diff) | |
download | ice-30782d480a0f5f732175dd22f49b56a013eb5fe6.tar.bz2 ice-30782d480a0f5f732175dd22f49b56a013eb5fe6.tar.xz ice-30782d480a0f5f732175dd22f49b56a013eb5fe6.zip |
more IcePatch stuff
Diffstat (limited to 'cpp/src/IcePatch/Client.cpp')
-rw-r--r-- | cpp/src/IcePatch/Client.cpp | 42 |
1 files changed, 33 insertions, 9 deletions
diff --git a/cpp/src/IcePatch/Client.cpp b/cpp/src/IcePatch/Client.cpp index 79480906f34..4af72481f07 100644 --- a/cpp/src/IcePatch/Client.cpp +++ b/cpp/src/IcePatch/Client.cpp @@ -10,6 +10,7 @@ #include <Ice/Application.h> #include <IcePatch/NodeDescFactory.h> +#include <IcePatch/NodeUtil.h> using namespace std; using namespace Ice; @@ -98,12 +99,20 @@ IcePatch::Client::run(int argc, char* argv[]) communicator()->addObjectFactory(factory, "::IcePatch::DirectoryDesc"); communicator()->addObjectFactory(factory, "::IcePatch::FileDesc"); - // - // Display node structure. - // - ObjectPrx topObj = communicator()->stringToProxy("IcePatch/.:" + endpoints); - NodePrx top = NodePrx::checkedCast(topObj); - printNodeDesc(top->describe()); + try + { + // + // Display node structure. + // + ObjectPrx topObj = communicator()->stringToProxy("IcePatch/.:" + endpoints); + NodePrx top = NodePrx::checkedCast(topObj); + printNodeDesc(top->describe()); + } + catch (const NodeAccessException& ex) + { + cerr << ex << ":\n" << ex.reason << endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } @@ -113,13 +122,14 @@ IcePatch::Client::printNodeDesc(const NodeDescPtr& nodeDesc) { string name; DirectoryDescPtr directoryDesc = DirectoryDescPtr::dynamicCast(nodeDesc); + FileDescPtr fileDesc; if (directoryDesc) { name = directoryDesc->directory->ice_getIdentity().name; } else { - FileDescPtr fileDesc = FileDescPtr::dynamicCast(nodeDesc); + fileDesc = FileDescPtr::dynamicCast(nodeDesc); assert(fileDesc); name = fileDesc->file->ice_getIdentity().name; } @@ -134,8 +144,14 @@ IcePatch::Client::printNodeDesc(const NodeDescPtr& nodeDesc) if (directoryDesc) { + cout << endl; printNodeDescSeq(directoryDesc->directory->getContents(), ""); } + else + { + assert(fileDesc); + cout << " (" << MD5ToString(fileDesc->md5) << ')' << endl; + } } void @@ -152,13 +168,14 @@ IcePatch::Client::printNodeDescSeq(const NodeDescSeq& nodeDescSeq, const string& { string name; DirectoryDescPtr directoryDesc = DirectoryDescPtr::dynamicCast(nodeDescSeq[i]); + FileDescPtr fileDesc; if (directoryDesc) { name = directoryDesc->directory->ice_getIdentity().name; } else { - FileDescPtr fileDesc = FileDescPtr::dynamicCast(nodeDescSeq[i]); + fileDesc = FileDescPtr::dynamicCast(nodeDescSeq[i]); assert(fileDesc); name = fileDesc->file->ice_getIdentity().name; } @@ -169,10 +186,12 @@ IcePatch::Client::printNodeDescSeq(const NodeDescSeq& nodeDescSeq, const string& name.erase(0, pos + 1); } - cout << indent << "+-" << name << endl; + cout << indent << "+-" << name; if (directoryDesc) { + cout << endl; + string newIndent; if (i < nodeDescSeq.size() - 1) { @@ -185,6 +204,11 @@ IcePatch::Client::printNodeDescSeq(const NodeDescSeq& nodeDescSeq, const string& printNodeDescSeq(directoryDesc->directory->getContents(), newIndent); } + else + { + assert(fileDesc); + cout << " (" << MD5ToString(fileDesc->md5) << ')' << endl; + } } cout << indent << " " << endl; |