Example #1
0
        public void Start()
        {
            if (_serviceHost != null)
            {
                throw new InvalidOperationException("Server is already started.");
            }

            var managementHandler = new ManagementTransferRequestHandler();

            managementHandler.Bind(Schema.DynamicMBeanResourceUri, new DynamicMBeanManagementRequestHandler(_server));
            managementHandler.Bind(Schema.MBeanServerResourceUri, new MBeanServerManagementRequestHandler(_server));

            var enumerationServer = new EnumerationServer();

            enumerationServer.Bind(Schema.DynamicMBeanResourceUri, Schema.QueryNamesDialect, typeof(string), new QueryNamesEnumerationRequestHandler(_server));
            enumerationServer.Bind(Schema.DynamicMBeanResourceUri, FilterMap.DefaultDialect, typeof(void), new IsRegisteredEnumerationRequestHandler(_server));

            var eventingServer = new EventingServer(new EventingRequestHandler(_server));

            eventingServer.Bind(Schema.NotificationDialect, typeof(NotificationFilter));
            eventingServer.EnablePullDeliveryUsing(enumerationServer.PullServer);

            var extensionHandler = new Jsr262ExtensionMethodHandler(_server);

            _serviceHost = new HttpListenerTransferEndpoint(_serviceUrl,
                                                            new TransferServer(managementHandler),
                                                            enumerationServer,
                                                            enumerationServer,
                                                            eventingServer,
                                                            extensionHandler);
        }
Example #2
0
 public void Stop()
 {
     if (_serviceHost == null)
     {
         throw new InvalidOperationException("Server is already stopped.");
     }
     _serviceHost.Dispose();
     _serviceHost = null;
 }