| View previous topic :: View next topic |
| Author |
Message |
ishanthilina General User

Joined: 17 Mar 2012 Posts: 46
|
Posted: Sun Jul 22, 2012 9:35 am Post subject: [Python] How to start a Job and continue loading Office...? |
|
|
Hi,
I am writing an extension which parses a big rdf graph and retrieves data from it. Since rdflib, the library I use to parse the graph, takes lot's of time to parse the graph, I added the following Jobs.xcu file to make the parse happen when Office starts.
| Code: |
<?xml version='1.0' encoding='UTF-8'?>
<oor:component-data
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
oor:package="org.openoffice.Office"
oor:name="Jobs">
<node oor:name="Jobs">
<node oor:name="org.creativecommons.openoffice" oor:op="replace">
<prop oor:name="Service" oor:type="xs:string">
<value>org.creativecommons.openoffice.CcOOoAddin</value>
</prop>
<node oor:name="Arguments">
</node>
</node>
</node>
<node oor:name="Events">
<node oor:name="OnStartApp" oor:op="fuse">
<node oor:name="JobList">
<node oor:name="org.creativecommons.openoffice" oor:op="replace"/>
</node>
</node>
<node oor:name="OnNew" oor:op="fuse">
<node oor:name="JobList">
<node oor:name="org.creativecommons.openoffice" oor:op="replace"/>
</node>
</node>
</node>
</oor:component-data>
|
But the problem is that if I use this method, Office will wait till the graph is parsed to load rest of the office components.
Is there anyway that I can trigger the graph parsing and continue to load Office (So that office will not wait till the graph is parsed to load the rest of the components)? |
|
| Back to top |
|
 |
hanya Super User

Joined: 04 May 2005 Posts: 543 Location: Japan
|
Posted: Mon Jul 23, 2012 9:05 am Post subject: |
|
|
| Did you try asynchronous job? If not implement css.task.XAsyncJob interface instead of XJob. |
|
| Back to top |
|
 |
ishanthilina General User

Joined: 17 Mar 2012 Posts: 46
|
Posted: Tue Jul 24, 2012 9:43 am Post subject: |
|
|
Hi Hanya,
Thanks for the reply. Yes, I tried it,but with no success. The called class implements the XAsyncJob as follows.
| Code: |
from com.sun.star.task import XAsyncJob
class CcLoAddin(unohelper.Base, XInitialization, XServiceInfo,
XDispatchProvider, XDispatch, XAsyncJob):
|
I don't need to change anything in the Jobs.xcu, do I? |
|
| Back to top |
|
 |
hanya Super User

Joined: 04 May 2005 Posts: 543 Location: Japan
|
Posted: Tue Jul 24, 2012 10:24 am Post subject: |
|
|
Seems not working for me too. The job executor internal implementation waits finish of async job after execution of executeAsync method.
So start new thread yourself in the execute method of XJob interface. |
|
| Back to top |
|
 |
|