コード例 #1
0
        static void Main()
        {
            log4net.Config.XmlConfigurator.Configure();

            OrbServices.CreateAndRegisterIiopChannel(0);

            String              componentModel       = Resources.ComponentDesc;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder builder              = new XmlComponentBuilder(componentInformation);
            ComponentContext    pingContext          = builder.build();

            //Escrevendo a IOR do IComponent no arquivo.
            IComponent  pingComponent = pingContext.GetIComponent();
            OrbServices orb           = OrbServices.GetSingleton();
            String      ior           = orb.object_to_string(pingComponent);

            String       iorPath = Resources.IorFilename;
            StreamWriter stream  = new StreamWriter(iorPath);

            try {
                stream.Write(ior);
            }
            finally {
                stream.Close();
            }

            Console.WriteLine("Componente ping está no ar.");
            Console.ReadLine();
        }
コード例 #2
0
        private static void ConnectToOpenBus()
        {
            // Define propriedades para a oferta de serviço a ser registrada no barramento
            IComponent ic = _component.GetIComponent();

            ServiceProperty[] properties =
            {
                new ServiceProperty("offer.domain",
                                    "Demo Independent Clock")
            };

            // Cria conexão e a define como conexão padrão tanto para entrada como saída.
            OpenBusContext context = ORBInitializer.Context;

            _conn = context.ConnectByAddress(_host, _port);
            context.SetDefaultConnection(_conn);

            // Cria registrador e adiciona a callback de login inválido
            _registerer          = new Registerer(ic, properties, _interval);
            _conn.OnInvalidLogin = InvalidLogin;

            // Faz o login e registra no barramento
            try {
                _conn.OnInvalidLogin(_conn, new LoginInfo());
            }
            catch (Exception e) {
                Console.WriteLine(e);
            }
            finally {
                if (!_conn.Login.HasValue || Offer == null)
                {
                    Exit(1);
                }
            }
        }
コード例 #3
0
        public void buildTest_UpdateIComponent()
        {
            String              componentModel       = Resources.Component11;
            TextReader          file                 = new StringReader(componentModel);
            XmlTextReader       componentInformation = new XmlTextReader(file);
            XmlComponentBuilder target               = new XmlComponentBuilder(componentInformation);

            ComponentContext   actual         = target.build();
            String             facetInterface = Repository.GetRepositoryID(typeof(IMetaInterface));
            MarshalByRefObject facet          = actual.GetIComponent().getFacet(facetInterface);

            Assert.IsNull(facet);
        }