1 //
2 // Copyright (c) ZeroC, Inc. All rights reserved.
3 //
4 
5 namespace IceInternal
6 {
7     public interface ProtocolPluginFacade
8     {
9         //
10         // Get the Communicator instance with which this facade is
11         // associated.
12         //
getCommunicator()13         Ice.Communicator getCommunicator();
14 
15         //
16         // Register an EndpointFactory.
17         //
addEndpointFactory(EndpointFactory factory)18         void addEndpointFactory(EndpointFactory factory);
19 
20         //
21         // Get an EndpointFactory.
22         //
getEndpointFactory(short type)23         EndpointFactory getEndpointFactory(short type);
24 
25         //
26         // Obtain the type for a name.
27         //
findType(string name)28         System.Type findType(string name);
29     }
30 
31     public sealed class ProtocolPluginFacadeI : ProtocolPluginFacade
32     {
ProtocolPluginFacadeI(Ice.Communicator communicator)33         public ProtocolPluginFacadeI(Ice.Communicator communicator)
34         {
35             _communicator = communicator;
36             _instance = Util.getInstance(communicator);
37         }
38 
39         //
40         // Get the Communicator instance with which this facade is
41         // associated.
42         //
getCommunicator()43         public Ice.Communicator getCommunicator()
44         {
45             return _communicator;
46         }
47 
48         //
49         // Register an EndpointFactory.
50         //
addEndpointFactory(EndpointFactory factory)51         public void addEndpointFactory(EndpointFactory factory)
52         {
53             _instance.endpointFactoryManager().add(factory);
54         }
55 
56         //
57         // Get an EndpointFactory.
58         //
getEndpointFactory(short type)59         public EndpointFactory getEndpointFactory(short type)
60         {
61             return _instance.endpointFactoryManager().get(type);
62         }
63 
64         //
65         // Obtain the type for a name.
66         //
findType(string name)67         public System.Type findType(string name)
68         {
69             return AssemblyUtil.findType(_instance, name);
70         }
71 
72         private Instance _instance;
73         private Ice.Communicator _communicator;
74     }
75 }
76