コード例 #1
0
ファイル: TestServiceI.cs プロジェクト: sgrzegorz/ice
    public TestService(Ice.Communicator serviceManagerCommunicator)
    {
        var facet = new TestFacet();

        // Install a custom admin facet.
        serviceManagerCommunicator.AddAdminFacet("TestFacet", facet);

        // The TestFacetI servant also implements PropertiesAdminUpdateCallback. Set the callback on the admin facet.
        Ice.IObject?propFacet = serviceManagerCommunicator.FindAdminFacet("IceBox.Service.TestService.Properties");
        if (propFacet is Ice.IPropertiesAdmin admin)
        {
            admin.Updated += (_, updates) => facet.Updated(updates);
        }
    }
コード例 #2
0
ファイル: TestI.cs プロジェクト: tchernobog/ice
        public IRemoteCommunicatorPrx createCommunicator(Dictionary <string, string> props, Current current)
        {
            //
            // Prepare the property set using the given properties.
            //
            ILogger?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
            {
                var testFacet = new TestFacet();
                communicator.AddAdminFacet(testFacet, "TestFacet");
            }
            catch (System.ArgumentException)
            {
            }

            //
            // The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback.
            // Set the callback on the admin facet.
            //
            var servant   = new RemoteCommunicator(communicator);
            var propFacet = communicator.FindAdminFacet("Properties");

            if (propFacet != null)
            {
                var admin = (INativePropertiesAdmin)propFacet;
                Debug.Assert(admin != null);
                admin.AddUpdateCallback(servant.updated);
            }

            return(current.Adapter.Add(servant, IRemoteCommunicatorPrx.Factory));
        }
コード例 #3
0
    public TestService(Ice.Communicator serviceManagerCommunicator)
    {
        var facet = new TestFacet();

        //
        // Install a custom admin facet.
        //
        serviceManagerCommunicator.AddAdminFacet(facet, "TestFacet");

        //
        // The TestFacetI servant also implements PropertiesAdminUpdateCallback.
        // Set the callback on the admin facet.
        //
        Ice.IObject?propFacet = serviceManagerCommunicator.FindAdminFacet("IceBox.Service.TestService.Properties");
        if (propFacet != null)
        {
            var admin = (Ice.INativePropertiesAdmin)propFacet;
            admin.AddUpdateCallback(facet.updated);
        }
    }
コード例 #4
0
        public IRemoteCommunicatorPrx createCommunicator(Dictionary <string, string> props, Current current)
        {
            //
            // Prepare the property set using the given properties.
            //
            ILogger?logger = null;

            if (props.TryGetValue("NullLogger", out string?value) &&
                int.TryParse(value, out int nullLogger) && nullLogger > 0)
            {
                logger = new NullLogger();
            }

            //
            // Initialize a new communicator.
            //
            var communicator = new Communicator(props, logger: logger);

            //
            // Install a custom admin facet.
            //
            try
            {
                var testFacet = new TestFacet();
                communicator.AddAdminFacet("TestFacet", testFacet);
            }
            catch (System.ArgumentException)
            {
            }

            // The RemoteCommunicator servant also implements PropertiesAdminUpdateCallback.
            var servant   = new RemoteCommunicator(communicator);
            var propFacet = communicator.FindAdminFacet("Properties");

            if (propFacet is IPropertiesAdmin admin)
            {
                admin.Updated += (_, updates) => servant.Updated(updates);
            }

            return(current.Adapter.AddWithUUID(servant, IRemoteCommunicatorPrx.Factory));
        }