diff options
author | Marc Laukien <marc@zeroc.com> | 2002-04-03 21:22:52 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2002-04-03 21:22:52 +0000 |
commit | 4178ad80a3978cfbd2f53a7e47bf0120ded7d4d5 (patch) | |
tree | 94813a418f0973f780a2620d70e975a97bfc8b6d /cpp/src/IcePatch/NodeLocator.cpp | |
parent | started with IcePatch (diff) | |
download | ice-4178ad80a3978cfbd2f53a7e47bf0120ded7d4d5.tar.bz2 ice-4178ad80a3978cfbd2f53a7e47bf0120ded7d4d5.tar.xz ice-4178ad80a3978cfbd2f53a7e47bf0120ded7d4d5.zip |
started with IcePatch
Diffstat (limited to 'cpp/src/IcePatch/NodeLocator.cpp')
-rw-r--r-- | cpp/src/IcePatch/NodeLocator.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/cpp/src/IcePatch/NodeLocator.cpp b/cpp/src/IcePatch/NodeLocator.cpp new file mode 100644 index 00000000000..91bea186cc4 --- /dev/null +++ b/cpp/src/IcePatch/NodeLocator.cpp @@ -0,0 +1,62 @@ +// ********************************************************************** +// +// Copyright (c) 2002 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <IcePatch/NodeLocator.h> + +using namespace std; +using namespace Ice; +using namespace IcePatch; + + +ObjectPtr +IcePatch::NodeLocator::locate(const ObjectAdapterPtr&, const Current& current, LocalObjectPtr&) +{ + assert(current.identity.category == "IcePack"); + + // + // Check whether the path (= identity.name) is valid. + // + string path = current.identity.name; + + if (path.empty()) + { + return 0; + } + + if (path[0] == '/') // Path must not start with '/'. + { + throw ObjectNotExistException(__FILE__, __LINE__); + } + + if (path.find("..") != string::npos) // Path must not contain '..'. + { + throw ObjectNotExistException(__FILE__, __LINE__); + } + + if (path.find(':') == 1) // Path cannot contain ':' as second character. + { + throw ObjectNotExistException(__FILE__, __LINE__); + } + + return 0; +} + +void +IcePatch::NodeLocator::finished(const ObjectAdapterPtr&, const Current& current, const ObjectPtr&, + const LocalObjectPtr&) +{ + // Nothing to do. +} + +void +IcePatch::NodeLocator::deactivate() +{ + // Nothing to do. +} |