public Test.RemoteCommunicatorPrx createCommunicator(Dictionary <string, string> props, Ice.Current current) { // // Prepare the property set using the given properties. // Ice.InitializationData init = new Ice.InitializationData(); init.properties = Ice.Util.createProperties(); foreach (KeyValuePair <string, string> e in props) { init.properties.setProperty(e.Key, e.Value); } if (init.properties.getPropertyAsInt("NullLogger") > 0) { init.logger = new NullLogger(); } // // Initialize a new communicator. // Ice.Communicator communicator = Ice.Util.initialize(init); // // Install a custom admin facet. // try { communicator.addAdminFacet <TestFacet, TestFacetTraits>(new TestFacetI(), "TestFacet"); } catch (System.ArgumentException ex) { } // // The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback. // Set the callback on the admin facet. // RemoteCommunicatorI servant = new RemoteCommunicatorI(communicator); var propFacet = communicator.findAdminFacet("Properties").servant; if (propFacet != null) { Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet; Debug.Assert(admin != null); admin.addUpdateCallback(servant.updated); } return(current.adapter.Add(servant)); }
public Test.RemoteCommunicatorPrx createCommunicator(Dictionary <string, string> props, Ice.Current current) { // // Prepare the property set using the given properties. // Logger?logger = null; string?value; int nullLogger; if (props.TryGetValue("NullLogger", out value) && int.TryParse(value, out nullLogger) && nullLogger > 0) { logger = new NullLogger(); } // // Initialize a new communicator. // var communicator = new Communicator(props, logger: logger); // // Install a custom admin facet. // try { communicator.AddAdminFacet <TestFacet, TestFacetTraits>(new TestFacetI(), "TestFacet"); } catch (System.ArgumentException ex) { } // // The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback. // Set the callback on the admin facet. // RemoteCommunicatorI servant = new RemoteCommunicatorI(communicator); var propFacet = communicator.FindAdminFacet("Properties").servant; if (propFacet != null) { Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet; Debug.Assert(admin != null); admin.addUpdateCallback(servant.updated); } return(current.Adapter.Add(servant)); }
override public Test.RemoteCommunicatorPrx createCommunicator(Dictionary <string, string> props, Ice.Current current) { // // Prepare the property set using the given properties. // Ice.InitializationData init = new Ice.InitializationData(); init.properties = Ice.Util.createProperties(); foreach (KeyValuePair <string, string> e in props) { init.properties.setProperty(e.Key, e.Value); } if (init.properties.getPropertyAsInt("NullLogger") > 0) { init.logger = new NullLogger(); } // // Initialize a new communicator. // Ice.Communicator communicator = Ice.Util.initialize(init); // // Install a custom admin facet. // communicator.addAdminFacet(new TestFacetI(), "TestFacet"); // // The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback. // Set the callback on the admin facet. // RemoteCommunicatorI servant = new RemoteCommunicatorI(communicator); Ice.Object propFacet = communicator.findAdminFacet("Properties"); if (propFacet != null) { Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet; Debug.Assert(admin != null); admin.addUpdateCallback(servant.updated); } Ice.ObjectPrx proxy = current.adapter.addWithUUID(servant); return(Test.RemoteCommunicatorPrxHelper.uncheckedCast(proxy)); }
public TestServiceI(Ice.Communicator serviceManagerCommunicator) { TestFacetI facet = new TestFacetI(); // // Install a custom admin facet. // serviceManagerCommunicator.addAdminFacet(facet, "TestFacet"); // // The TestFacetI servant also implements PropertiesAdminUpdateCallback. // Set the callback on the admin facet. // Ice.Object propFacet = serviceManagerCommunicator.findAdminFacet("IceBox.Service.TestService.Properties"); if (propFacet != null) { Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)propFacet; admin.addUpdateCallback(facet.updated); } }
override public int run(string[] args) { if (args.Length > 0) { System.Console.Error.WriteLine(appName() + ": too many arguments"); return(1); } PropsI props = new PropsI(); // // Retrieve the PropertiesAdmin facet and register the servant as the update callback. // Ice.Object obj = communicator().findAdminFacet("Properties"); Ice.NativePropertiesAdmin admin = (Ice.NativePropertiesAdmin)obj; admin.addUpdateCallback(props); Ice.ObjectAdapter adapter = communicator().createObjectAdapter("Props"); adapter.add(props, communicator().stringToIdentity("props")); adapter.activate(); communicator().waitForShutdown(); return(0); }