On Fri, Jun 14, 2013 at 12:00:55AM +0530, Rajath Shashidhara wrote:
> Hello Ariel,
> 
> for making the ucp return the same single component factory object, shall I
> create a static single component factory object and return it if it is not
> null and create a new one if it is null? By this way we can return the same
> single component factory object.

Please study this example:
http://people.apache.org/~arielch/extensions/OneInstanceJob.zip

It has a UNO component implementing a css.task.Job.

The Job will be instantiated every time a new document is created or
loaded. With the standard factory helper, createInstanceWithContext
returns always a new instance; with the modified factory helper in that
example, there is only one instance of the job.
 
> Although, one thing I have not understood is what is the consequences of
> returning different single component factory objects?

The difference is in having several instances of your content provider,
versus having a single instance during all the application lifetime.
Recall: you have to cache UCB contents, you may get several call to
queryContent() with the same content id, one after the other, and you
should return the same content.

Side note: caching contents does not mean caching content's properties;
on the contrary, your implementation should decide which properties are
cachable and which not (see for example isCachable() in
ucb/source/ucp/webdav/ContentProperties.cxx).


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Attachment: pgpy2MPTGYtKx.pgp
Description: PGP signature

Reply via email to