diff options
author | Marc Laukien <marc@zeroc.com> | 2001-09-27 18:58:55 +0000 |
---|---|---|
committer | Marc Laukien <marc@zeroc.com> | 2001-09-27 18:58:55 +0000 |
commit | b42a7bbf16c4495ae7b9d5108e7d726f3ebb8356 (patch) | |
tree | faaf559e36cb8a03427618ce0cff4ecf9dbd260b /cpp/src/Ice/Direct.cpp | |
parent | Freeze fixes (diff) | |
download | ice-b42a7bbf16c4495ae7b9d5108e7d726f3ebb8356.tar.bz2 ice-b42a7bbf16c4495ae7b9d5108e7d726f3ebb8356.tar.xz ice-b42a7bbf16c4495ae7b9d5108e7d726f3ebb8356.zip |
location transparency stuff
Diffstat (limited to 'cpp/src/Ice/Direct.cpp')
-rw-r--r-- | cpp/src/Ice/Direct.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/cpp/src/Ice/Direct.cpp b/cpp/src/Ice/Direct.cpp new file mode 100644 index 00000000000..f88987a7d45 --- /dev/null +++ b/cpp/src/Ice/Direct.cpp @@ -0,0 +1,82 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +#include <Ice/Direct.h> +#include <Ice/ObjectAdapter.h> +#include <Ice/Reference.h> +#include <Ice/Object.h> +#include <Ice/LocalException.h> + +using namespace std; +using namespace Ice; +using namespace IceInternal; + +IceInternal::Direct::Direct(const ObjectAdapterPtr& adapter, const ReferencePtr& ref, const char* operation) : + _adapter(adapter), + _reference(ref), + _operation(operation) +{ + _servant = _adapter->identityToServant(_reference->identity); + + try + { + if (!_servant) + { + _locator = _adapter->getServantLocator(); + if (_locator) + { + _servant = _locator->locate(_adapter, _reference->identity, _operation, _cookie); + } + } + + if(!_servant) + { + throw ObjectNotExistException(__FILE__, __LINE__); + } + } + catch(const LocationForward&) + { + if (_locator && _servant) + { + _locator->finished(_adapter, _reference->identity, _servant, _operation, _cookie); + } + throw; + } + catch(const LocalException&) + { + if (_locator && _servant) + { + _locator->finished(_adapter, _reference->identity, _servant, _operation, _cookie); + } + throw; + } + catch(...) + { + if (_locator && _servant) + { + _locator->finished(_adapter, _reference->identity, _servant, _operation, _cookie); + } + throw UnknownException(__FILE__, __LINE__); + } +} + +IceInternal::Direct::~Direct() +{ + if (_locator && _servant) + { + _locator->finished(_adapter, _reference->identity, _servant, _operation, _cookie); + } +} + +const ObjectPtr& +IceInternal::Direct::servant() +{ + return _servant; +} |