def run(self,args): from omero.rtypes import ObjectFactories as rFactories from omero.columns import ObjectFactories as cFactories props = self.communicator().getProperties() configure_server_logging(props) self.logger = logging.getLogger("omero.util.Server") self.logger.info("*"*80) self.logger.info("Starting") failures = 0 for x in self.dependencies: if not x.check(self.logger): failures += 1 if failures: self.logger.error("Missing dependencies: %s" % failures) sys.exit(50) self.shutdownOnInterrupt() try: self.objectfactory = omero.clients.ObjectFactory() self.objectfactory.registerObjectFactory(self.communicator()) for of in rFactories.values() + cFactories.values(): of.register(self.communicator()) try: serverid = self.communicator().getProperties().getProperty("Ice.ServerId") ctx = ServerContext(serverid, self.communicator(), self.stop_event) self.impl = self.impl_class(ctx) getattr(self.impl, "cleanup") # Required per docs except: self.logger.error("Failed initialization", exc_info=1) sys.exit(100) try: self.adapter = self.communicator().createObjectAdapter(self.adapter_name) self.adapter.activate() ctx.add_servant(self.adapter, self.impl, self.identity) # calls setProxy prx = self.adapter.createDirectProxy(self.identity) # ticket:1978 for non-collocated registries add_grid_object(self.communicator(), prx) # This must happen _after_ activation except: self.logger.error("Failed activation", exc_info=1) sys.exit(200) self.logger.info("Entering main loop") self.communicator().waitForShutdown() finally: self.stop_event.set() # Let's all waits shutdown self.logger.info("Cleanup") self.cleanup() self.logger.info("Stopped") self.logger.info("*"*80)
def run(self,args): from omero.rtypes import ObjectFactories as rFactories from omero.columns import ObjectFactories as cFactories props = self.communicator().getProperties() configure_server_logging(props) self.logger = logging.getLogger("omero.util.Server") self.logger.info("*"*80) self.waitOnStartup() self.logger.info("Starting") failures = 0 for x in self.dependencies: if not x.check(self.logger): failures += 1 if failures: self.logger.error("Missing dependencies: %s" % failures) sys.exit(50) self.shutdownOnInterrupt() try: ofr.registerObjectFactory(self.communicator(), None) # No client for of in rFactories.values() + cFactories.values(): of.register(self.communicator()) try: serverid = self.communicator().getProperties().getProperty("Ice.ServerId") ctx = ServerContext(serverid, self.communicator(), self.stop_event) self.impl = self.impl_class(ctx) getattr(self.impl, "cleanup") # Required per docs except: self.logger.error("Failed initialization", exc_info=1) sys.exit(100) try: self.adapter = self.communicator().createObjectAdapter(self.adapter_name) self.adapter.activate() ctx.add_servant(self.adapter, self.impl, self.identity) # calls setProxy prx = self.adapter.createDirectProxy(self.identity) # ticket:1978 for non-collocated registries add_grid_object(self.communicator(), prx) # This must happen _after_ activation except: self.logger.error("Failed activation", exc_info=1) sys.exit(200) self.logger.info("Entering main loop") self.communicator().waitForShutdown() finally: self.stop_event.set() # Let's all waits shutdown self.logger.info("Cleanup") self.cleanup() self.logger.info("Stopped") self.logger.info("*"*80)
def __init__(self): self.delegate = Ice.initialize() for of in ObjectFactories.values(): of.register(self.delegate) # Columns