[Erp5-report] r44936 nicolas - /erp5/trunk/utils/cloudooo.handler.ooo/src/cloudooo/handler/...

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Mar 31 19:13:57 CEST 2011


Author: nicolas
Date: Thu Mar 31 19:13:57 2011
New Revision: 44936

URL: http://svn.erp5.org?rev=44936&view=rev
Log:
Create new method to bootstrap the Handler at startup

Modified:
    erp5/trunk/utils/cloudooo.handler.ooo/src/cloudooo/handler/ooo/handler.py

Modified: erp5/trunk/utils/cloudooo.handler.ooo/src/cloudooo/handler/ooo/handler.py
URL: http://svn.erp5.org/erp5/trunk/utils/cloudooo.handler.ooo/src/cloudooo/handler/ooo/handler.py?rev=44936&r1=44935&r2=44936&view=diff
==============================================================================
--- erp5/trunk/utils/cloudooo.handler.ooo/src/cloudooo/handler/ooo/handler.py [utf8] (original)
+++ erp5/trunk/utils/cloudooo.handler.ooo/src/cloudooo/handler/ooo/handler.py [utf8] Thu Mar 31 19:13:57 2011
@@ -215,3 +215,47 @@ class Handler(object):
     doc_loaded = self.document.getContent()
     self.document.trash()
     return doc_loaded
+
+def bootstrapHandler(configuration_dict):
+  # Bootstrap handler
+  from signal import signal, SIGINT, SIGQUIT, SIGHUP
+  from cloudooo.handler.ooo.mimemapper import mimemapper
+  from cloudooo.handler.ooo.application.openoffice import openoffice
+  import cloudooo.handler.ooo.monitor as monitor
+
+  def stopProcesses(signum, frame):
+    monitor.stop()
+    openoffice.stop()
+
+  # Signal to stop all processes
+  signal(SIGINT, stopProcesses)
+  signal(SIGQUIT, stopProcesses)
+  signal(SIGHUP, stopProcesses)
+
+  working_path = configuration_dict.get('working_path')
+  application_hostname = configuration_dict.get('application_hostname')
+  openoffice_port = int(configuration_dict.get('openoffice_port'))
+  environment_dict = configuration_dict['environment_dict']
+  # Loading Configuration to start OOo Instance and control it
+  openoffice.loadSettings(application_hostname,
+                          openoffice_port,
+                          working_path,
+                          configuration_dict.get('office_binary_path'),
+                          configuration_dict.get('uno_path'),
+                          configuration_dict.get('openoffice_user_interface_language',
+                                                 'en'),
+                          environment_dict=environment_dict,
+                          )
+  openoffice.start()
+  monitor.load(configuration_dict)
+
+  timeout_response = int(configuration_dict.get('timeout_response'))
+  kw = dict(uno_path=configuration_dict.get('uno_path'),
+            office_binary_path=configuration_dict.get('office_binary_path'),
+            timeout=timeout_response)
+
+  # Load all filters
+  openoffice.acquire()
+  mimemapper.loadFilterList(application_hostname,
+                            openoffice_port, **kw)
+  openoffice.release()



More information about the Erp5-report mailing list