OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

[Python] How to start a Job and continue loading Office...?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
ishanthilina
General User
General User


Joined: 17 Mar 2012
Posts: 46

PostPosted: Sun Jul 22, 2012 9:35 am    Post subject: [Python] How to start a Job and continue loading Office...? Reply with quote

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
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Mon Jul 23, 2012 9:05 am    Post subject: Reply with quote

Did you try asynchronous job? If not implement css.task.XAsyncJob interface instead of XJob.
Back to top
View user's profile Send private message
ishanthilina
General User
General User


Joined: 17 Mar 2012
Posts: 46

PostPosted: Tue Jul 24, 2012 9:43 am    Post subject: Reply with quote

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
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Tue Jul 24, 2012 10:24 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group