Hi Rajath,

On Sun, Jun 02, 2013 at 12:12:11AM +0530, Rajath Shashidhara wrote:
> Hello,
> 
> I read the wikipages about UCB and UCP(all the links in these mails), One
> thing I did not understand is:
> What functions are called under what situations from the UCP?
> What are those functions supposed to do?
> 
> For example:
> what is the function:
> registerInstance() supposed to do?
> 
> What should be implemented in each of these methods?

In these cases, you have to consult the API reference:
http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/ContentProvider.html
Both XContentIdentifierFactory and XParameterizedContentProvider are
optional.

This is a little tricky: in general, an optional interface means that
you don't need to implement it if you don't need to; but in several
cases, new properties and interfaces are introduced as optional, as
a workaround, just because the service is published and cannot be
modified.

For now, only implement the required interfaces, comment out the
optional ones, and later on, when you have the whole picture, you can
come back to this.

The main interface for the css.ucb.ContentProvider is
css.ucb.XContentProvider. Concentrate on queryContent()
http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/XContentProvider.html#queryContent

"creates a new XContent instance, if the given XContentIdentifier
matches a content provided by the implementation of this interface."

If the content identifier is supported by your implementation (did you
already define this?), you have to return an object implementing
http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/Content.html
Here again, some interface are optionals; and in the documentation of
XCommandProcessor in this page you can find the set of commands and
properties, some are mandatory, some are optional.

To create this new Java UNO object, right-click on the package, and
select New - Other.... On the "New File" dialog, choose "Apache
OpenOffice" under "Categories" and "Java UNO Object" under "File Types".
On the next step, select com.sun.star.ucb.Content as the "IDL Type" to
implement.

IMO it is better to start implementing this step by step, and not using
the file picker to test, but a macro, like this one:
http://people.apache.org/~arielch/api/UCB_demo.odt

Start with  "getPropertyValues" and do not bother by now with
authentication (this is a rather complex subject, IMO it is better to
get a general picture now), simply hard-code user and password in your
code. You can try with http://cmis.alfresco.com/ (with user=admin and
password=admin) or set-up your own server.

"getPropertyValues" is the most basic UCB command. You have to implement
the mandatory properties. And implemente it in a way that you don't
download the file from the server, but simply read the metadata, see
http://chemistry.apache.org/java/examples/example-read-meta-content.html
You have to map CMIS metadata with UCB properties.


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Attachment: pgpo9TMumdANW.pgp
Description: PGP signature

Reply via email to