openoffice-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ariel Constenla-Haile <>
Subject Re: CMIS UCP
Date Sun, 02 Jun 2013 06:36:06 GMT

Hi Rajath,

On Sun, Jun 02, 2013 at 09:58:56AM +0530, Rajath Shashidhara wrote:
> Hello,
> Now that I have added a UNO Object of IDL type Content, there are some
> methods that need to be implemented.
> Out of which, getIdentifier() is one of
> them.
> I have read the api reference for XContentIdentifier.
> It needs XComponentContext as an argument for its constructor.

XContentIdentifier is a class, it does not have constructor.

> That can be obtained from the argument to the constructor of my UCP class.
> But, my question is what is identifier?
> Is it the name of the file/folder ?
> Also, the second method, getContentProviderScheme()
> does it refer to the way of writing the path as cmis://<path> ?

At the beginning you can simply use the default implementation. Try the
following macro in an office installation without your extension, it
will return cmis as schema is the identifier starts with cmis://

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

Option Explicit

Sub Main
    Dim aMap as Object
    aMap ="string","")

    Dim oUCB as Object
    oUCB = CreateUnoService("")

    Dim sIds()
    sIds = Array(_
        "cmis://" )
    Dim sId$
    For Each sId in sIds
        aMap.put( sId, oUCB.createContentIdentifier( sId ) )

    Dim oEnum as Object
    oEnum = aMap.createElementEnumeration(false)
    While oEnum.hasMoreElements()
        Dim oPair as Object
        oPair = oEnum.nextElement()
        MsgBox "URL: " + oPair.First + Chr(13) + _
                "Content ID: " + oPair.Second.getContentIdentifier() + Chr(13) + _
                "Content Scheme: " + oPair.Second.getContentProviderScheme()
End Sub

If you want to implement the content identifier yourself, just create
a class that implements XContentIdentifier.

And simply reuse the XContentIdentifier you get in queryContent():

    public XContent queryContent(XContentIdentifier xIdentifier) throws IllegalIdentifierException
        if (!isValidIdentifier(xIdentifier)) {
            throw new IllegalIdentifierException();
        // Check if a content with given XContentIdentifier already exists
        // TODO implement a cache mechanism, for example a hash map
        // Key: xIdentifier.getContentIdentifier()
        // Value: xIdentifier
        XContent xRet = queryExistingContent(xIdentifier);
        if (xRet != null) {
            return xRet;

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

        return aContent;

Ariel Constenla-Haile
La Plata, Argentina

View raw message