diff options
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; +} |