Commit 83e4903a authored by Nicolas Delaby's avatar Nicolas Delaby

Create new method to bootstrap the Handler at startup


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@44936 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 214491ad
......@@ -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()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment