openoffice-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ariel Constenla-Haile <ariel.constenla.ha...@gmail.com>
Subject Fwd: CMIS UCP
Date Sun, 02 Jun 2013 20:25:46 GMT
It seems Apache SMTP service is failing, forwarding via my gmail account.


---------- Forwarded message ----------
From: Ariel Constenla-Haile <arielch@apache.org>
Date: Sun, Jun 2, 2013 at 2:46 PM
Subject: Re: CMIS UCP
To: dev@openoffice.apache.org


Hi Rajath,

On Sun, Jun 02, 2013 at 05:12:03PM +0530, Rajath Shashidhara wrote:
> Hi Ariel,
>
>
> I'm still not clear about one thing:
> I'm completing the implementation of the function execute() for
> "getPropertyValues" command.
> But, until now I assumed that the path and name of the object whose
> properties I'm getting are contained in the XIdentifier object that is a
> parameter to queryContent method. My Implementation of XContent has an
> constructor with XContentIdentifier as one of the parameters.
>
> But, I added a cout statement to the file ucp to print the
> XContentIdentifierObject->getContentIdentifier(), thinking that the
> returned string will be the path to the content which is being queried.
> But, the print statements were a little a bunch of hexadecimals, when I
> tried to access a file from open dialog.

May be it is better to play with the open dialog later, when you
implement listing a directory; for now, it is easier to play with
a Basic macro. The open dialog will query your UCP the moment you start
typing cmis:/ which is not a valid content identifier for your UCP. As
you already understood, you check this in queryContent:

    public XContent queryContent(XContentIdentifier xIdentifier)
        throws IllegalIdentifierException {

        Logger.getLogger(CMISContentProvider.class.getName()).log(
                Level.INFO,
                String.format("Content ID \"%s\"",
xIdentifier.getContentIdentifier()));

        if (!isValidIdentifier(xIdentifier)) {
            throw new IllegalIdentifierException();
        }

        // Check if a content with given XContentIdentifier already exists
        // TODO implement a hash map
        // Key: xIdentifier.getContentIdentifier()
        // Value: XContent
        XContent xRet = queryExistingContent(xIdentifier);
        if (xRet != null) {
            return xRet;
        }

        CMISContent aContent = new CMISContent(m_xContext, xIdentifier);
        // cache the new content
        registerNewContent(aContent);

        return aContent;
    }

Two notes:

- you have to cache contents
- related to this, there should be only one instance of your UCP; test
  with the following macro (replace
  "org.apache.openoffice.ucp.cmis.CMISContentProvider" witht the
  implementation name of your UCP):

REM  *****  BASIC  *****

Sub Main
    Dim o1, o2, o3, o4
    o1 = CreateUnoService("org.apache.openoffice.ucp.cmis.CMISContentProvider")
    o2 = CreateUnoService("org.apache.openoffice.ucp.cmis.CMISContentProvider")
    MsgBox EqualUnoObjects( o1, o2 )

    o3 = CreateUnoService("com.sun.star.comp.FTPContentProvider")
    o4 = CreateUnoService("com.sun.star.comp.FTPContentProvider")
    MsgBox EqualUnoObjects( o3, o4 )
End Sub


> Also, is the argument in the Command refer to which property is being
> referred?

For the command "getPropertyValues", the argument is a sequence of
com.sun.star.beans.Property, where Name has the name of the property.
Note that it is a sequence even if it a single property. Use
com.sun.star.uno.AnyConverter to convert the any.


Regards
--
Ariel Constenla-Haile
La Plata, Argentina

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
For additional commands, e-mail: dev-help@openoffice.apache.org


Mime
View raw message