class Win32NodeService(win32serviceutil.ServiceFramework): _svc_name_ = "AGNodeService" _svc_display_name_ = "Access Grid Virtual Venue Service" _defaultPort = 8000 def __init__(self,args): # Initialize Logging ntl = Log.handlers.NTEventLogHandler("AG VenueServer") ntl.setLevel(Log.DEBUG) self.log = Log.GetLogger(Log.VenueServer) Log.HandleLoggers(ntl, Log.GetDefaultLoggers()) # Initialize Win32 Service stuff win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) # Make a hosting environment self.server = Server(self._defaultPort) # Make a venue server self.venueService = VenueServer(self.server) # Make a Service Manager Service self.server.RegisterObject(self.venueService, path='/VenueServer') # tell the world we are here self.log.info("Created VenueServer.") def SvcStop(self): # Service status report self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) # Wait for a stop event win32event.SetEvent(self.hWaitStop) # Stop the server self.server.stop() # Tell the world self.log.info("Stopped Venue Server.") def SvcDoRun(self): # Run the service win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) # Tell the world self.server.run() # Wait for a stop self.log.info("Started Venue Server.")
class Win32NodeService(win32serviceutil.ServiceFramework): _svc_name_ = "AGNodeService" _svc_display_name_ = "Access Grid Node Service" _defaultPort = 11000 def __init__(self,args): # Initilialize Logging self.ntl = Log.handlers.NTEventLogHandler("AG Node Service") self.ntl.setLevel(Log.DEBUG) self.log = Log.GetLogger(Log.NodeService) Log.HandleLoggers(self.ntl, Log.GetDefaultLoggers()) # Initialize Win32 Service stuff win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) # Make a node service self.nodeService = AGNodeService() # Make a hosting environment self.server = Server(self._defaultPort) # Make a node service service self.server.RegisterObject(self.nodeService, path='/NodeService') # Tell the world we're here self.log.info("Created Node Service.") def SvcStop(self): # Service status report self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) # Wait for a stop event win32event.SetEvent(self.hWaitStop) # Stop the server self.server.stop() # Tell the world self.log.info("Stopping Node Service.") def SvcDoRun(self): # Run the service self.server.run_in_thread() # Tell the world self.log.info("Starting service; URI: ", self.nodeService.get_handle()) # Wait for a stop win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE)
class Win32NodeService(win32serviceutil.ServiceFramework): _svc_name_ = "AGNodeService" _svc_display_name_ = "Access Grid Virtual Venue Service" _defaultPort = 8000 def __init__(self, args): # Initialize Logging ntl = Log.handlers.NTEventLogHandler("AG VenueServer") ntl.setLevel(Log.DEBUG) self.log = Log.GetLogger(Log.VenueServer) Log.HandleLoggers(ntl, Log.GetDefaultLoggers()) # Initialize Win32 Service stuff win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) # Make a hosting environment self.server = Server(self._defaultPort) # Make a venue server self.venueService = VenueServer(self.server) # Make a Service Manager Service self.server.RegisterObject(self.venueService, path='/VenueServer') # tell the world we are here self.log.info("Created VenueServer.") def SvcStop(self): # Service status report self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) # Wait for a stop event win32event.SetEvent(self.hWaitStop) # Stop the server self.server.stop() # Tell the world self.log.info("Stopped Venue Server.") def SvcDoRun(self): # Run the service win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE) # Tell the world self.server.run() # Wait for a stop self.log.info("Started Venue Server.")
class Win32NodeService(win32serviceutil.ServiceFramework): _svc_name_ = "AGNodeService" _svc_display_name_ = "Access Grid Node Service" _defaultPort = 11000 def __init__(self, args): # Initilialize Logging self.ntl = Log.handlers.NTEventLogHandler("AG Node Service") self.ntl.setLevel(Log.DEBUG) self.log = Log.GetLogger(Log.NodeService) Log.HandleLoggers(self.ntl, Log.GetDefaultLoggers()) # Initialize Win32 Service stuff win32serviceutil.ServiceFramework.__init__(self, args) self.hWaitStop = win32event.CreateEvent(None, 0, 0, None) # Make a node service self.nodeService = AGNodeService() # Make a hosting environment self.server = Server(self._defaultPort) # Make a node service service self.server.RegisterObject(self.nodeService, path='/NodeService') # Tell the world we're here self.log.info("Created Node Service.") def SvcStop(self): # Service status report self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING) # Wait for a stop event win32event.SetEvent(self.hWaitStop) # Stop the server self.server.stop() # Tell the world self.log.info("Stopping Node Service.") def SvcDoRun(self): # Run the service self.server.run_in_thread() # Tell the world self.log.info("Starting service; URI: ", self.nodeService.get_handle()) # Wait for a stop win32event.WaitForSingleObject(self.hWaitStop, win32event.INFINITE)