summaryrefslogtreecommitdiff
path: root/cpp/src/IcePack/LocatorI.cpp
blob: 28e62fa48f33145aa479344c9e5c46f0e263049b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// **********************************************************************
//
// Copyright (c) 2001
// MutableRealms, Inc.
// Huntsville, AL, USA
//
// All Rights Reserved
//
// **********************************************************************

#include <Ice/Ice.h>

#include <IcePack/AdapterManager.h>
#include <IcePack/LocatorI.h>

using namespace std;
using namespace Ice;
using namespace IcePack;

IcePack::LocatorI::LocatorI(const AdapterManagerPrx& adapters, const LocatorRegistryPrx& registry) :
    _adapters(adapters),
    _registry(registry)
{
}

Ice::ObjectPrx 
IcePack::LocatorI::findAdapterByName(const string& name, const Current&)
{
    try
    {
	AdapterPrx adapter = _adapters->findByName(name);
	if(adapter)
	{
	    return adapter->getDirectProxy(true);
	}
    }
    catch (const AdapterActivationTimeoutException&)
    {
    }
    catch (const ObjectNotExistException&)
    {
    }

    return 0;
}

Ice::LocatorRegistryPrx
IcePack::LocatorI::getRegistry(const Current&)
{
    return _registry;
}