public void Initialize()
        {
            _server = new NetMX.Default.MBeanServer();
             _relationService = new RelationService();
             _server.RegisterMBean(_relationService, ":type=RelationService");

             _parent = new Parent();
             _server.RegisterMBean(_parent, ":type=Parent");
             _child1 = new Child();
             _server.RegisterMBean(_child1, ":type=Child,id=1");
             _child2 = new Child();
             _server.RegisterMBean(_child2, ":type=Child,id=2");

             _relationService.CreateRelationType("Parenthood",
            new RoleInfo[] {
               new RoleInfo("Parent", typeof(ParentMBean), true, true, 1, 1, "Parent"),
               new RoleInfo("Child", typeof(ChildMBean), true, true, 0, RoleInfo.RoleCardinalityInfinity, "Child") });
        }
示例#2
0
        public void Initialize()
        {
            _server          = new MBeanServer();
            _relationService = new RelationService();
            _server.RegisterMBean(_relationService, ":type=RelationService");

            _parent = new Parent();
            _server.RegisterMBean(_parent, ":type=Parent");
            _child1 = new Child();
            _server.RegisterMBean(_child1, ":type=Child,id=1");
            _child2 = new Child();
            _server.RegisterMBean(_child2, ":type=Child,id=2");

            _relationService.CreateRelationType("Parenthood",
                                                new RoleInfo[] {
                new RoleInfo("Parent", typeof(ParentMBean), true, true, 1, 1, "Parent"),
                new RoleInfo("Child", typeof(ChildMBean), true, true, 0, RoleInfo.RoleCardinalityInfinity, "Child")
            });
        }
示例#3
0
        private static void InitializeMBeanServer()
        {
            _beanServer = MBeanServerFactory.CreateMBeanServer();

            _beanServer.RegisterMBean(new RelationService(), RelationService.ObjectName);

            Sample sample1 = new Sample();
            Sample sample2 = new Sample();
            Sample sample3 = new Sample();

            _beanServer.RegisterMBean(sample1, "Sample:type=Sample,id=1");
            _beanServer.RegisterMBean(sample2, "Sample:type=Sample,id=2");
            _beanServer.RegisterMBean(sample3, "Sample:type=Sample,id=3");

            RelationServiceMBean relationSerice = NetMXProxyExtensions.NewMBeanProxy <RelationServiceMBean>(_beanServer, RelationService.ObjectName);

            relationSerice.CreateRelationType("Binding", new RoleInfo[] {
                new RoleInfo("Source", typeof(SampleMBean), true, false, 1, 1, "Source"),
                new RoleInfo("Destination", typeof(SampleMBean), true, false, 1, 1, "Destination")
            });

            relationSerice.CreateRelation("Rel1", "Binding", new Role[] {
                new Role("Source", new ObjectName("Sample:type=Sample,id=1")),
                new Role("Destination", new ObjectName("Sample:type=Sample,id=2"))
            });

            relationSerice.CreateRelation("Rel2", "Binding", new Role[] {
                new Role("Source", new ObjectName("Sample:type=Sample,id=1")),
                new Role("Destination", new ObjectName("Sample:type=Sample,id=3"))
            });

            Uri serviceUrl = new Uri("net.pipe://localhost/MBeanServer");

            _connectorServer = NetMXConnectorServerFactory.NewNetMXConnectorServer(serviceUrl, _beanServer);
            _connectorServer.Start();
        }