summaryrefslogtreecommitdiff
path: root/java/test/Ice/location/ServerLocatorRegistry.java
blob: 242188754809b38b3111427e6649c99b4f9eb559 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// **********************************************************************
//
// Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************

public class ServerLocatorRegistry extends Test._TestLocatorRegistryDisp
{
    public void
    setAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setAdapterDirectProxy cb, String adapter,
				Ice.ObjectPrx object, Ice.Current current)
    {
	_adapters.put(adapter, object);
	cb.ice_response();
    }

    public void
    setReplicatedAdapterDirectProxy_async(Ice.AMD_LocatorRegistry_setReplicatedAdapterDirectProxy cb, String adapter, 
					  String replica, Ice.ObjectPrx object, Ice.Current current)
    {
	_adapters.put(adapter, object);
	_adapters.put(replica, object);
	cb.ice_response();
    }

    public void
    setServerProcessProxy_async(Ice.AMD_LocatorRegistry_setServerProcessProxy cb, String id, Ice.ProcessPrx proxy,
				Ice.Current current)
    {
    }

    public void
    addObject(Ice.ObjectPrx object, Ice.Current current)
    {
	_objects.put(object.ice_getIdentity(), object);
    }

    public Ice.ObjectPrx
    getAdapter(String adapter)
	throws Ice.AdapterNotFoundException
    {
	Ice.ObjectPrx obj = (Ice.ObjectPrx)_adapters.get(adapter);
	if(obj == null)
	{
	    throw new Ice.AdapterNotFoundException();
	}
	return obj;
    }

    public Ice.ObjectPrx
    getObject(Ice.Identity id)
	throws Ice.ObjectNotFoundException
    {
	Ice.ObjectPrx obj = (Ice.ObjectPrx)_objects.get(id);
	if(obj == null)
	{
	    throw new Ice.ObjectNotFoundException();   
	}
	return obj;
    }

    private java.util.HashMap _adapters = new java.util.HashMap();
    private java.util.HashMap _objects = new java.util.HashMap();
}