You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by Rajath Shashidhara <ra...@gmail.com> on 2013/06/01 17:35:34 UTC

Re: CMIS UCP

Hello Ariel,

Your code has these lines in queryContent() method:
System.out.printf("queryContent()\n");
System.out.printf("Identifier: %s\n", xIdentifier.getContentIdentifier());
System.out.printf("Scheme: \n", xIdentifier.getContentProviderScheme());

So, when I try to open a file from CMIS repository,
does it mean that these print statements should be executed?
So, I will be able to see the print statements on the terminal when I start
openoffice from terminal?


On Sat, Jun 1, 2013 at 2:04 AM, Ariel Constenla-Haile <ar...@apache.org>wrote:

> On Sat, Jun 01, 2013 at 12:12:34AM +0530, Rajath Shashidhara wrote:
> > Hello,
> >
> > Where can I find the code of OpenOffice UCB?
>
> already answered at the end of
> http://markmail.org/message/jgnq7plytaog5wbi As suggested there, start
> first with plain/pure UNO, get an overview of how UCB works, and then
> look at the C++ impleimentation only if necessary. The code is complex,
> it uses several internal helper classes that won't be accessible to you.
>
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Ariel Constenla-Haile <ar...@gmail.com>.
On Sun, Jun 02, 2013 at 11:06:40PM +0530, Rajath Shashidhara wrote:
> Hello Ariel,
> 
> function:
> compareContentIds
> Description:
> 0 is returned, if the identifiers are equal. A value less than 0 indiactes,
> that the Id1 is less than Id2. A value greater than 0 is returned, if Id1
> is greater than Id2.
> 
> What is less than?
> Is it below in the file hierarchy? Are alphabetic?

How to compare, depends on the implementation. For example,
ExpandContentProviderImpl::compareContentIds() first expands posible
macros in the content ids, and them compares the two strings. For now,
you can simple compare the strings lexically.


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Re: CMIS UCP

Posted by Ariel Constenla-Haile <ar...@apache.org>.
Hi Rajath,

On Sun, Jun 02, 2013 at 02:03:56PM +0530, Rajath Shashidhara wrote:
> Hello,
> 
> Sorry for asking too many questions.

It's alright :)

> The method execute in the XContent implementation class I have created,
> which has parameters: com.sun.star.ucb.Command aCommand, int CommandId,
> com.sun.star.ucb.XCommandEnvironment Environment
> 
> now aCommand object has three attributes:
> Name,handle,argument
> 
> So if trying to get Metadata. we use command as getPropertyValues.
> "getPropertyValues" is the name of the command,

I would state it with the sentences switched:

if the application is executing the command "getPropertyValues", you
have to get meta-data from the CMIS service without downloading anything
expect the meta-data itself.

"getPropertyValues" is one of the commands to be first executed by the
application, usually to know if the content represents a folder or
a document.

> argument -> which property to get.

in plural, even if it is only one property, you get a sequence.

> What is handle?

Look at the API reference:
http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/Command.html

long Handle;
contains an implementation specific handle for the command. 

It is up to the implementation (that is, you) whether to use it or
simply ignore it. You can ignore it now and come back later.

> Also what is commandid? Any enumeration to represent various commandids?

For CommandId read
http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/XCommandProcessor.html#execute
"is a unique id for the command. This identifier was obtained by calling
XCommandProcessor::createCommandIdentifier."

Most (if not all) implementations in the core code simply ignore this parameter.


Note that different css.ucb.Command's have different Command.Argument,
and XCommandProcessor.execute() returns different things. This is
document in the Dev's Guide, and with more detail in
http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/Content.html
The SDK from trunk has a nicer formatted documentation.

For "getPropertyValues" you will have to implement a css::sdbc::XRow,
the internal helper implementation is ucbhelper::PropertyValueSet in 
main/ucbhelper/inc/ucbhelper/propertyvalueset.hxx
main/ucbhelper/source/provider/propertyvalueset.cxx


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Re: CMIS UCP

Posted by Ariel Constenla-Haile <ar...@apache.org>.
Hi Rajath,

On Mon, Jun 03, 2013 at 11:36:05PM +0530, Rajath Shashidhara wrote:
> Hello Juergen,
> 
> I have type casted it to Property[].
> This page says that the argument for getPropertyValues is
> sequence<Property> type.
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/Content.html
> 
> I'm not able to define such a variable type <sequence> .

Because the IDL reference talks about IDL types. You have to understand
how this IDL types are mapped to Java, the Developer's Guide is your
friend: 
http://wiki.openoffice.org/wiki/Documentation/DevGuide/FirstSteps/Common_Types
http://wiki.openoffice.org/wiki/Documentation/DevGuide/FirstSteps/Any
http://wiki.openoffice.org/wiki/Documentation/DevGuide/FirstSteps/Sequence

http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Data_Types

http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Java/Java_Language_Binding
http://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Java/Type_Mappings


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello,

I rebuilt openoffice using this switch --enable-category-b to enable the
macro security dialog box. But, now openoffice exits as soon as I click
Macro security button.

I wont be able to test my work without this. Please help.
Also, Is there any procedure/code to write to register the new UCP to UCB?


On Mon, Jun 3, 2013 at 11:41 PM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Hello Juergen,
> Ok.
>
>
> On Mon, Jun 3, 2013 at 11:40 PM, Jürgen Schmidt <jo...@gmail.com>wrote:
>
>> On 6/3/13 8:06 PM, Rajath Shashidhara wrote:
>> > Hello Juergen,
>> >
>> > I have type casted it to Property[].
>> > This page says that the argument for getPropertyValues is
>> > sequence<Property> type.
>> >
>> http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/Content.html
>> >
>> > I'm not able to define such a variable type <sequence> .
>> > I'll test my code with the macro sent by Ariel.
>> > Because, executeCommand() helper method calls ucp execute() method with
>> > argument initialized with a type Property[].
>> >
>> > I'll get back to you about what I used anyConverter or typeCast.
>>
>> you should use the AnyConverter to be save and avoid problems
>>
>> Juergen
>>
>> >
>> >
>> > On Mon, Jun 3, 2013 at 11:26 PM, Jürgen Schmidt <jogischmidt@gmail.com
>> >wrote:
>> >
>> >> On 6/3/13 6:46 PM, Rajath Shashidhara wrote:
>> >>> Hello,
>> >>>
>> >>>
>> >>> I have changed the getPropertyValues return type to XRow.
>> >>>
>> >>> One Problem I'm facing is that the stated UNOtype sequence is not
>> >> available
>> >>> for me. I checked com.sun.star.uno package also. I typecasted the
>> >>> command.argument to Property[] because
>> >>> from these two examples:
>> >>>
>> >>
>> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
>> >>>
>> >>
>> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
>> >>>
>> >>> Argument is initialized as com.sun.star.beans.Property[](specifying it
>> >>> particularly because there is a Property type in chemistry api also).
>> >>
>> >> the Command.Argument is of type Any, see and use AnyConverter to
>> convert
>> >> object into Any ->
>> >>
>> >>
>> http://www.openoffice.org/api/docs/java/ref/com/sun/star/uno/AnyConverter.html
>> >>
>> >>
>> >> Juergen
>> >>
>> >>>
>> >>> Again My github:
>> >>> https://github.com/rajaths589/CMISContentProvider.git
>> >>>
>> >>>
>> >>> On Mon, Jun 3, 2013 at 1:00 PM, Jürgen Schmidt <jogischmidt@gmail.com
>> >>> wrote:
>> >>>
>> >>>> Hi Rajath,
>> >>>>
>> >>>> first of all sorry for not answering over the weekend but I try to
>> take
>> >>>> a "real" break over the weekend and focus on some private work items.
>> >>>>
>> >>>> But Ariel gave you very detailed and good advice, it seems that he
>> would
>> >>>> be a better mentor ;-)
>> >>>>
>> >>>> The office API will be of course the more difficult part of this
>> project
>> >>>> because you won't find so much documentation and samples as for Java.
>> >>>> The UCB is a special candidate in the office API and it takes some
>> time
>> >>>> to understand it. Exception are playing a special role in the
>> context of
>> >>>> the UCB and you will learn this over time.
>> >>>>
>> >>>> The SDK contains also an example showing the usage of the UCB API.
>> But
>> >>>> it's a good idea to play around on your own and get some
>> understanding
>> >>>> how it works.
>> >>>>
>> >>>> Juergen
>> >>>>
>> >>>>
>> >>>>
>> >>>>
>> >>>> On 6/3/13 6:59 AM, Rajath Shashidhara wrote:
>> >>>>> Hello Ariel,
>> >>>>>
>> >>>>> Actually, this is my first code using openoffice api.
>> >>>>> I'll do these before completing my ucp.
>> >>>>>
>> >>>>> Sorry. I'll get back to you with the understanding of the general
>> api.
>> >>>>>
>> >>>>>
>> >>>>> On Mon, Jun 3, 2013 at 10:20 AM, Ariel Constenla-Haile <
>> >>>>> ariel.constenla.haile@gmail.com> wrote:
>> >>>>>
>> >>>>>> Hi Rajath,
>> >>>>>>
>> >>>>>> On Mon, Jun 03, 2013 at 01:28:24AM +0530, Rajath Shashidhara wrote:
>> >>>>>>> Hello everyone,
>> >>>>>>>
>> >>>>>>> I have completed some part of the CMISUCP.
>> >>>>>>>
>> >>>>>>> I have made my own implementation of XContent, XContentIdentifier
>> >>>>>>> interfaces.
>> >>>>>>>
>> >>>>>>> I have partially Completed implementation of the following
>> methods:
>> >>>>>>> queryContent()
>> >>>>>>> execute() -> "getPropertyValues", "open"
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> I was not very clear about the return type of execute method.
>> >>>>>>> I might have erred there.
>> >>>>>>
>> >>>>>> In "open" you are returning a java.io.InputStream.  According to
>> the
>> >> API
>> >>>>>> documentation, "For non-folder objects, the OpenCommandArgument2
>> >> struct
>> >>>>>> will be prefilled with a data sink object, which will be filled
>> with
>> >> the
>> >>>>>> content data."; important point: "OpenCommandArgument::Sink: a
>> sink,
>> >>>>>> where the implementation can put the document data into."
>> >>>>>>
>> >>>>>> And in "getPropertyValues" you are returning
>> >>>>>> a java.util.Map<String,String>. According to the API docs, the
>> return
>> >>>>>> type is a ::com::sun::star::sdbc::XRow (as told in a previous
>> mail).
>> >>>>>>
>> >>>>>> Both errors tell me you need a deeper knowledge of the UCB API:
>> before
>> >>>>>> trying to implement your own UCP, you need a general understanding
>> of
>> >>>>>> how the UCB API works, this is something fundamental, and these two
>> >>>>>> basic errors tell you are missing this point.
>> >>>>>>
>> >>>>>> So back to the basics:
>> >>>>>>
>> >>>>>> - create client application
>> >>>>>> - using the UCB API, get some properties of a file/folder
>> >>>>>> - if the content is a file, execute an "open" command. If the
>> content
>> >> is
>> >>>>>>   a folder, list its content.
>> >>>>>> - if the content is a file,
>> >>>>>>   a) store the stream to disk
>> >>>>>>   b) use the stream to load the file inside OpenOffice
>> >>>>>>
>> >>>>>> The code should work using local files/folders, http, webdav, etc.
>> Try
>> >>>>>> with http://demo.owncloud.org/files/webdav.php so that you have to
>> >> use
>> >>>>>> an interaction handler for authentication (user=test,
>> password=test).
>> >>>>>>
>> >>>>>> This (together with reading the API reference) will give you a
>> first
>> >>>>>> idea of how "open" and "getPropertyValues" work.
>> >>>>>>
>> >>>>>>
>> >>>>>> 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
>> >>>>
>> >>>>
>> >>>
>> >>>
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
>> >> For additional commands, e-mail: dev-help@openoffice.apache.org
>> >>
>> >>
>> >
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
>> For additional commands, e-mail: dev-help@openoffice.apache.org
>>
>>
>
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello Juergen,
Ok.


On Mon, Jun 3, 2013 at 11:40 PM, Jürgen Schmidt <jo...@gmail.com>wrote:

> On 6/3/13 8:06 PM, Rajath Shashidhara wrote:
> > Hello Juergen,
> >
> > I have type casted it to Property[].
> > This page says that the argument for getPropertyValues is
> > sequence<Property> type.
> >
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/Content.html
> >
> > I'm not able to define such a variable type <sequence> .
> > I'll test my code with the macro sent by Ariel.
> > Because, executeCommand() helper method calls ucp execute() method with
> > argument initialized with a type Property[].
> >
> > I'll get back to you about what I used anyConverter or typeCast.
>
> you should use the AnyConverter to be save and avoid problems
>
> Juergen
>
> >
> >
> > On Mon, Jun 3, 2013 at 11:26 PM, Jürgen Schmidt <jogischmidt@gmail.com
> >wrote:
> >
> >> On 6/3/13 6:46 PM, Rajath Shashidhara wrote:
> >>> Hello,
> >>>
> >>>
> >>> I have changed the getPropertyValues return type to XRow.
> >>>
> >>> One Problem I'm facing is that the stated UNOtype sequence is not
> >> available
> >>> for me. I checked com.sun.star.uno package also. I typecasted the
> >>> command.argument to Property[] because
> >>> from these two examples:
> >>>
> >>
> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
> >>>
> >>
> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
> >>>
> >>> Argument is initialized as com.sun.star.beans.Property[](specifying it
> >>> particularly because there is a Property type in chemistry api also).
> >>
> >> the Command.Argument is of type Any, see and use AnyConverter to convert
> >> object into Any ->
> >>
> >>
> http://www.openoffice.org/api/docs/java/ref/com/sun/star/uno/AnyConverter.html
> >>
> >>
> >> Juergen
> >>
> >>>
> >>> Again My github:
> >>> https://github.com/rajaths589/CMISContentProvider.git
> >>>
> >>>
> >>> On Mon, Jun 3, 2013 at 1:00 PM, Jürgen Schmidt <jogischmidt@gmail.com
> >>> wrote:
> >>>
> >>>> Hi Rajath,
> >>>>
> >>>> first of all sorry for not answering over the weekend but I try to
> take
> >>>> a "real" break over the weekend and focus on some private work items.
> >>>>
> >>>> But Ariel gave you very detailed and good advice, it seems that he
> would
> >>>> be a better mentor ;-)
> >>>>
> >>>> The office API will be of course the more difficult part of this
> project
> >>>> because you won't find so much documentation and samples as for Java.
> >>>> The UCB is a special candidate in the office API and it takes some
> time
> >>>> to understand it. Exception are playing a special role in the context
> of
> >>>> the UCB and you will learn this over time.
> >>>>
> >>>> The SDK contains also an example showing the usage of the UCB API. But
> >>>> it's a good idea to play around on your own and get some understanding
> >>>> how it works.
> >>>>
> >>>> Juergen
> >>>>
> >>>>
> >>>>
> >>>>
> >>>> On 6/3/13 6:59 AM, Rajath Shashidhara wrote:
> >>>>> Hello Ariel,
> >>>>>
> >>>>> Actually, this is my first code using openoffice api.
> >>>>> I'll do these before completing my ucp.
> >>>>>
> >>>>> Sorry. I'll get back to you with the understanding of the general
> api.
> >>>>>
> >>>>>
> >>>>> On Mon, Jun 3, 2013 at 10:20 AM, Ariel Constenla-Haile <
> >>>>> ariel.constenla.haile@gmail.com> wrote:
> >>>>>
> >>>>>> Hi Rajath,
> >>>>>>
> >>>>>> On Mon, Jun 03, 2013 at 01:28:24AM +0530, Rajath Shashidhara wrote:
> >>>>>>> Hello everyone,
> >>>>>>>
> >>>>>>> I have completed some part of the CMISUCP.
> >>>>>>>
> >>>>>>> I have made my own implementation of XContent, XContentIdentifier
> >>>>>>> interfaces.
> >>>>>>>
> >>>>>>> I have partially Completed implementation of the following methods:
> >>>>>>> queryContent()
> >>>>>>> execute() -> "getPropertyValues", "open"
> >>>>>>>
> >>>>>>>
> >>>>>>> I was not very clear about the return type of execute method.
> >>>>>>> I might have erred there.
> >>>>>>
> >>>>>> In "open" you are returning a java.io.InputStream.  According to the
> >> API
> >>>>>> documentation, "For non-folder objects, the OpenCommandArgument2
> >> struct
> >>>>>> will be prefilled with a data sink object, which will be filled with
> >> the
> >>>>>> content data."; important point: "OpenCommandArgument::Sink: a sink,
> >>>>>> where the implementation can put the document data into."
> >>>>>>
> >>>>>> And in "getPropertyValues" you are returning
> >>>>>> a java.util.Map<String,String>. According to the API docs, the
> return
> >>>>>> type is a ::com::sun::star::sdbc::XRow (as told in a previous mail).
> >>>>>>
> >>>>>> Both errors tell me you need a deeper knowledge of the UCB API:
> before
> >>>>>> trying to implement your own UCP, you need a general understanding
> of
> >>>>>> how the UCB API works, this is something fundamental, and these two
> >>>>>> basic errors tell you are missing this point.
> >>>>>>
> >>>>>> So back to the basics:
> >>>>>>
> >>>>>> - create client application
> >>>>>> - using the UCB API, get some properties of a file/folder
> >>>>>> - if the content is a file, execute an "open" command. If the
> content
> >> is
> >>>>>>   a folder, list its content.
> >>>>>> - if the content is a file,
> >>>>>>   a) store the stream to disk
> >>>>>>   b) use the stream to load the file inside OpenOffice
> >>>>>>
> >>>>>> The code should work using local files/folders, http, webdav, etc.
> Try
> >>>>>> with http://demo.owncloud.org/files/webdav.php so that you have to
> >> use
> >>>>>> an interaction handler for authentication (user=test,
> password=test).
> >>>>>>
> >>>>>> This (together with reading the API reference) will give you a first
> >>>>>> idea of how "open" and "getPropertyValues" work.
> >>>>>>
> >>>>>>
> >>>>>> 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
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
> >> For additional commands, e-mail: dev-help@openoffice.apache.org
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
> For additional commands, e-mail: dev-help@openoffice.apache.org
>
>


-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Jürgen Schmidt <jo...@gmail.com>.
On 6/3/13 8:06 PM, Rajath Shashidhara wrote:
> Hello Juergen,
> 
> I have type casted it to Property[].
> This page says that the argument for getPropertyValues is
> sequence<Property> type.
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/Content.html
> 
> I'm not able to define such a variable type <sequence> .
> I'll test my code with the macro sent by Ariel.
> Because, executeCommand() helper method calls ucp execute() method with
> argument initialized with a type Property[].
> 
> I'll get back to you about what I used anyConverter or typeCast.

you should use the AnyConverter to be save and avoid problems

Juergen

> 
> 
> On Mon, Jun 3, 2013 at 11:26 PM, Jürgen Schmidt <jo...@gmail.com>wrote:
> 
>> On 6/3/13 6:46 PM, Rajath Shashidhara wrote:
>>> Hello,
>>>
>>>
>>> I have changed the getPropertyValues return type to XRow.
>>>
>>> One Problem I'm facing is that the stated UNOtype sequence is not
>> available
>>> for me. I checked com.sun.star.uno package also. I typecasted the
>>> command.argument to Property[] because
>>> from these two examples:
>>>
>> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
>>>
>> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
>>>
>>> Argument is initialized as com.sun.star.beans.Property[](specifying it
>>> particularly because there is a Property type in chemistry api also).
>>
>> the Command.Argument is of type Any, see and use AnyConverter to convert
>> object into Any ->
>>
>> http://www.openoffice.org/api/docs/java/ref/com/sun/star/uno/AnyConverter.html
>>
>>
>> Juergen
>>
>>>
>>> Again My github:
>>> https://github.com/rajaths589/CMISContentProvider.git
>>>
>>>
>>> On Mon, Jun 3, 2013 at 1:00 PM, Jürgen Schmidt <jogischmidt@gmail.com
>>> wrote:
>>>
>>>> Hi Rajath,
>>>>
>>>> first of all sorry for not answering over the weekend but I try to take
>>>> a "real" break over the weekend and focus on some private work items.
>>>>
>>>> But Ariel gave you very detailed and good advice, it seems that he would
>>>> be a better mentor ;-)
>>>>
>>>> The office API will be of course the more difficult part of this project
>>>> because you won't find so much documentation and samples as for Java.
>>>> The UCB is a special candidate in the office API and it takes some time
>>>> to understand it. Exception are playing a special role in the context of
>>>> the UCB and you will learn this over time.
>>>>
>>>> The SDK contains also an example showing the usage of the UCB API. But
>>>> it's a good idea to play around on your own and get some understanding
>>>> how it works.
>>>>
>>>> Juergen
>>>>
>>>>
>>>>
>>>>
>>>> On 6/3/13 6:59 AM, Rajath Shashidhara wrote:
>>>>> Hello Ariel,
>>>>>
>>>>> Actually, this is my first code using openoffice api.
>>>>> I'll do these before completing my ucp.
>>>>>
>>>>> Sorry. I'll get back to you with the understanding of the general api.
>>>>>
>>>>>
>>>>> On Mon, Jun 3, 2013 at 10:20 AM, Ariel Constenla-Haile <
>>>>> ariel.constenla.haile@gmail.com> wrote:
>>>>>
>>>>>> Hi Rajath,
>>>>>>
>>>>>> On Mon, Jun 03, 2013 at 01:28:24AM +0530, Rajath Shashidhara wrote:
>>>>>>> Hello everyone,
>>>>>>>
>>>>>>> I have completed some part of the CMISUCP.
>>>>>>>
>>>>>>> I have made my own implementation of XContent, XContentIdentifier
>>>>>>> interfaces.
>>>>>>>
>>>>>>> I have partially Completed implementation of the following methods:
>>>>>>> queryContent()
>>>>>>> execute() -> "getPropertyValues", "open"
>>>>>>>
>>>>>>>
>>>>>>> I was not very clear about the return type of execute method.
>>>>>>> I might have erred there.
>>>>>>
>>>>>> In "open" you are returning a java.io.InputStream.  According to the
>> API
>>>>>> documentation, "For non-folder objects, the OpenCommandArgument2
>> struct
>>>>>> will be prefilled with a data sink object, which will be filled with
>> the
>>>>>> content data."; important point: "OpenCommandArgument::Sink: a sink,
>>>>>> where the implementation can put the document data into."
>>>>>>
>>>>>> And in "getPropertyValues" you are returning
>>>>>> a java.util.Map<String,String>. According to the API docs, the return
>>>>>> type is a ::com::sun::star::sdbc::XRow (as told in a previous mail).
>>>>>>
>>>>>> Both errors tell me you need a deeper knowledge of the UCB API: before
>>>>>> trying to implement your own UCP, you need a general understanding of
>>>>>> how the UCB API works, this is something fundamental, and these two
>>>>>> basic errors tell you are missing this point.
>>>>>>
>>>>>> So back to the basics:
>>>>>>
>>>>>> - create client application
>>>>>> - using the UCB API, get some properties of a file/folder
>>>>>> - if the content is a file, execute an "open" command. If the content
>> is
>>>>>>   a folder, list its content.
>>>>>> - if the content is a file,
>>>>>>   a) store the stream to disk
>>>>>>   b) use the stream to load the file inside OpenOffice
>>>>>>
>>>>>> The code should work using local files/folders, http, webdav, etc. Try
>>>>>> with http://demo.owncloud.org/files/webdav.php so that you have to
>> use
>>>>>> an interaction handler for authentication (user=test, password=test).
>>>>>>
>>>>>> This (together with reading the API reference) will give you a first
>>>>>> idea of how "open" and "getPropertyValues" work.
>>>>>>
>>>>>>
>>>>>> 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
>>>>
>>>>
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
>> For additional commands, e-mail: dev-help@openoffice.apache.org
>>
>>
> 
> 


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


Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello Juergen,

I have type casted it to Property[].
This page says that the argument for getPropertyValues is
sequence<Property> type.
http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/Content.html

I'm not able to define such a variable type <sequence> .
I'll test my code with the macro sent by Ariel.
Because, executeCommand() helper method calls ucp execute() method with
argument initialized with a type Property[].

I'll get back to you about what I used anyConverter or typeCast.


On Mon, Jun 3, 2013 at 11:26 PM, Jürgen Schmidt <jo...@gmail.com>wrote:

> On 6/3/13 6:46 PM, Rajath Shashidhara wrote:
> > Hello,
> >
> >
> > I have changed the getPropertyValues return type to XRow.
> >
> > One Problem I'm facing is that the stated UNOtype sequence is not
> available
> > for me. I checked com.sun.star.uno package also. I typecasted the
> > command.argument to Property[] because
> > from these two examples:
> >
> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
> >
> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
> >
> > Argument is initialized as com.sun.star.beans.Property[](specifying it
> > particularly because there is a Property type in chemistry api also).
>
> the Command.Argument is of type Any, see and use AnyConverter to convert
> object into Any ->
>
> http://www.openoffice.org/api/docs/java/ref/com/sun/star/uno/AnyConverter.html
>
>
> Juergen
>
> >
> > Again My github:
> > https://github.com/rajaths589/CMISContentProvider.git
> >
> >
> > On Mon, Jun 3, 2013 at 1:00 PM, Jürgen Schmidt <jogischmidt@gmail.com
> >wrote:
> >
> >> Hi Rajath,
> >>
> >> first of all sorry for not answering over the weekend but I try to take
> >> a "real" break over the weekend and focus on some private work items.
> >>
> >> But Ariel gave you very detailed and good advice, it seems that he would
> >> be a better mentor ;-)
> >>
> >> The office API will be of course the more difficult part of this project
> >> because you won't find so much documentation and samples as for Java.
> >> The UCB is a special candidate in the office API and it takes some time
> >> to understand it. Exception are playing a special role in the context of
> >> the UCB and you will learn this over time.
> >>
> >> The SDK contains also an example showing the usage of the UCB API. But
> >> it's a good idea to play around on your own and get some understanding
> >> how it works.
> >>
> >> Juergen
> >>
> >>
> >>
> >>
> >> On 6/3/13 6:59 AM, Rajath Shashidhara wrote:
> >>> Hello Ariel,
> >>>
> >>> Actually, this is my first code using openoffice api.
> >>> I'll do these before completing my ucp.
> >>>
> >>> Sorry. I'll get back to you with the understanding of the general api.
> >>>
> >>>
> >>> On Mon, Jun 3, 2013 at 10:20 AM, Ariel Constenla-Haile <
> >>> ariel.constenla.haile@gmail.com> wrote:
> >>>
> >>>> Hi Rajath,
> >>>>
> >>>> On Mon, Jun 03, 2013 at 01:28:24AM +0530, Rajath Shashidhara wrote:
> >>>>> Hello everyone,
> >>>>>
> >>>>> I have completed some part of the CMISUCP.
> >>>>>
> >>>>> I have made my own implementation of XContent, XContentIdentifier
> >>>>> interfaces.
> >>>>>
> >>>>> I have partially Completed implementation of the following methods:
> >>>>> queryContent()
> >>>>> execute() -> "getPropertyValues", "open"
> >>>>>
> >>>>>
> >>>>> I was not very clear about the return type of execute method.
> >>>>> I might have erred there.
> >>>>
> >>>> In "open" you are returning a java.io.InputStream.  According to the
> API
> >>>> documentation, "For non-folder objects, the OpenCommandArgument2
> struct
> >>>> will be prefilled with a data sink object, which will be filled with
> the
> >>>> content data."; important point: "OpenCommandArgument::Sink: a sink,
> >>>> where the implementation can put the document data into."
> >>>>
> >>>> And in "getPropertyValues" you are returning
> >>>> a java.util.Map<String,String>. According to the API docs, the return
> >>>> type is a ::com::sun::star::sdbc::XRow (as told in a previous mail).
> >>>>
> >>>> Both errors tell me you need a deeper knowledge of the UCB API: before
> >>>> trying to implement your own UCP, you need a general understanding of
> >>>> how the UCB API works, this is something fundamental, and these two
> >>>> basic errors tell you are missing this point.
> >>>>
> >>>> So back to the basics:
> >>>>
> >>>> - create client application
> >>>> - using the UCB API, get some properties of a file/folder
> >>>> - if the content is a file, execute an "open" command. If the content
> is
> >>>>   a folder, list its content.
> >>>> - if the content is a file,
> >>>>   a) store the stream to disk
> >>>>   b) use the stream to load the file inside OpenOffice
> >>>>
> >>>> The code should work using local files/folders, http, webdav, etc. Try
> >>>> with http://demo.owncloud.org/files/webdav.php so that you have to
> use
> >>>> an interaction handler for authentication (user=test, password=test).
> >>>>
> >>>> This (together with reading the API reference) will give you a first
> >>>> idea of how "open" and "getPropertyValues" work.
> >>>>
> >>>>
> >>>> 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
> >>
> >>
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@openoffice.apache.org
> For additional commands, e-mail: dev-help@openoffice.apache.org
>
>


-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Jürgen Schmidt <jo...@gmail.com>.
On 6/3/13 6:46 PM, Rajath Shashidhara wrote:
> Hello,
> 
> 
> I have changed the getPropertyValues return type to XRow.
> 
> One Problem I'm facing is that the stated UNOtype sequence is not available
> for me. I checked com.sun.star.uno package also. I typecasted the
> command.argument to Property[] because
> from these two examples:
> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
> http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
> 
> Argument is initialized as com.sun.star.beans.Property[](specifying it
> particularly because there is a Property type in chemistry api also).

the Command.Argument is of type Any, see and use AnyConverter to convert
object into Any ->
http://www.openoffice.org/api/docs/java/ref/com/sun/star/uno/AnyConverter.html


Juergen

> 
> Again My github:
> https://github.com/rajaths589/CMISContentProvider.git
> 
> 
> On Mon, Jun 3, 2013 at 1:00 PM, Jürgen Schmidt <jo...@gmail.com>wrote:
> 
>> Hi Rajath,
>>
>> first of all sorry for not answering over the weekend but I try to take
>> a "real" break over the weekend and focus on some private work items.
>>
>> But Ariel gave you very detailed and good advice, it seems that he would
>> be a better mentor ;-)
>>
>> The office API will be of course the more difficult part of this project
>> because you won't find so much documentation and samples as for Java.
>> The UCB is a special candidate in the office API and it takes some time
>> to understand it. Exception are playing a special role in the context of
>> the UCB and you will learn this over time.
>>
>> The SDK contains also an example showing the usage of the UCB API. But
>> it's a good idea to play around on your own and get some understanding
>> how it works.
>>
>> Juergen
>>
>>
>>
>>
>> On 6/3/13 6:59 AM, Rajath Shashidhara wrote:
>>> Hello Ariel,
>>>
>>> Actually, this is my first code using openoffice api.
>>> I'll do these before completing my ucp.
>>>
>>> Sorry. I'll get back to you with the understanding of the general api.
>>>
>>>
>>> On Mon, Jun 3, 2013 at 10:20 AM, Ariel Constenla-Haile <
>>> ariel.constenla.haile@gmail.com> wrote:
>>>
>>>> Hi Rajath,
>>>>
>>>> On Mon, Jun 03, 2013 at 01:28:24AM +0530, Rajath Shashidhara wrote:
>>>>> Hello everyone,
>>>>>
>>>>> I have completed some part of the CMISUCP.
>>>>>
>>>>> I have made my own implementation of XContent, XContentIdentifier
>>>>> interfaces.
>>>>>
>>>>> I have partially Completed implementation of the following methods:
>>>>> queryContent()
>>>>> execute() -> "getPropertyValues", "open"
>>>>>
>>>>>
>>>>> I was not very clear about the return type of execute method.
>>>>> I might have erred there.
>>>>
>>>> In "open" you are returning a java.io.InputStream.  According to the API
>>>> documentation, "For non-folder objects, the OpenCommandArgument2 struct
>>>> will be prefilled with a data sink object, which will be filled with the
>>>> content data."; important point: "OpenCommandArgument::Sink: a sink,
>>>> where the implementation can put the document data into."
>>>>
>>>> And in "getPropertyValues" you are returning
>>>> a java.util.Map<String,String>. According to the API docs, the return
>>>> type is a ::com::sun::star::sdbc::XRow (as told in a previous mail).
>>>>
>>>> Both errors tell me you need a deeper knowledge of the UCB API: before
>>>> trying to implement your own UCP, you need a general understanding of
>>>> how the UCB API works, this is something fundamental, and these two
>>>> basic errors tell you are missing this point.
>>>>
>>>> So back to the basics:
>>>>
>>>> - create client application
>>>> - using the UCB API, get some properties of a file/folder
>>>> - if the content is a file, execute an "open" command. If the content is
>>>>   a folder, list its content.
>>>> - if the content is a file,
>>>>   a) store the stream to disk
>>>>   b) use the stream to load the file inside OpenOffice
>>>>
>>>> The code should work using local files/folders, http, webdav, etc. Try
>>>> with http://demo.owncloud.org/files/webdav.php so that you have to use
>>>> an interaction handler for authentication (user=test, password=test).
>>>>
>>>> This (together with reading the API reference) will give you a first
>>>> idea of how "open" and "getPropertyValues" work.
>>>>
>>>>
>>>> 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
>>
>>
> 
> 


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


Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello,


I have changed the getPropertyValues return type to XRow.

One Problem I'm facing is that the stated UNOtype sequence is not available
for me. I checked com.sun.star.uno package also. I typecasted the
command.argument to Property[] because
from these two examples:
http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands
http://wiki.openoffice.org/wiki/Documentation/DevGuide/UCB/Executing_Content_Commands

Argument is initialized as com.sun.star.beans.Property[](specifying it
particularly because there is a Property type in chemistry api also).

Again My github:
https://github.com/rajaths589/CMISContentProvider.git


On Mon, Jun 3, 2013 at 1:00 PM, Jürgen Schmidt <jo...@gmail.com>wrote:

> Hi Rajath,
>
> first of all sorry for not answering over the weekend but I try to take
> a "real" break over the weekend and focus on some private work items.
>
> But Ariel gave you very detailed and good advice, it seems that he would
> be a better mentor ;-)
>
> The office API will be of course the more difficult part of this project
> because you won't find so much documentation and samples as for Java.
> The UCB is a special candidate in the office API and it takes some time
> to understand it. Exception are playing a special role in the context of
> the UCB and you will learn this over time.
>
> The SDK contains also an example showing the usage of the UCB API. But
> it's a good idea to play around on your own and get some understanding
> how it works.
>
> Juergen
>
>
>
>
> On 6/3/13 6:59 AM, Rajath Shashidhara wrote:
> > Hello Ariel,
> >
> > Actually, this is my first code using openoffice api.
> > I'll do these before completing my ucp.
> >
> > Sorry. I'll get back to you with the understanding of the general api.
> >
> >
> > On Mon, Jun 3, 2013 at 10:20 AM, Ariel Constenla-Haile <
> > ariel.constenla.haile@gmail.com> wrote:
> >
> >> Hi Rajath,
> >>
> >> On Mon, Jun 03, 2013 at 01:28:24AM +0530, Rajath Shashidhara wrote:
> >>> Hello everyone,
> >>>
> >>> I have completed some part of the CMISUCP.
> >>>
> >>> I have made my own implementation of XContent, XContentIdentifier
> >>> interfaces.
> >>>
> >>> I have partially Completed implementation of the following methods:
> >>> queryContent()
> >>> execute() -> "getPropertyValues", "open"
> >>>
> >>>
> >>> I was not very clear about the return type of execute method.
> >>> I might have erred there.
> >>
> >> In "open" you are returning a java.io.InputStream.  According to the API
> >> documentation, "For non-folder objects, the OpenCommandArgument2 struct
> >> will be prefilled with a data sink object, which will be filled with the
> >> content data."; important point: "OpenCommandArgument::Sink: a sink,
> >> where the implementation can put the document data into."
> >>
> >> And in "getPropertyValues" you are returning
> >> a java.util.Map<String,String>. According to the API docs, the return
> >> type is a ::com::sun::star::sdbc::XRow (as told in a previous mail).
> >>
> >> Both errors tell me you need a deeper knowledge of the UCB API: before
> >> trying to implement your own UCP, you need a general understanding of
> >> how the UCB API works, this is something fundamental, and these two
> >> basic errors tell you are missing this point.
> >>
> >> So back to the basics:
> >>
> >> - create client application
> >> - using the UCB API, get some properties of a file/folder
> >> - if the content is a file, execute an "open" command. If the content is
> >>   a folder, list its content.
> >> - if the content is a file,
> >>   a) store the stream to disk
> >>   b) use the stream to load the file inside OpenOffice
> >>
> >> The code should work using local files/folders, http, webdav, etc. Try
> >> with http://demo.owncloud.org/files/webdav.php so that you have to use
> >> an interaction handler for authentication (user=test, password=test).
> >>
> >> This (together with reading the API reference) will give you a first
> >> idea of how "open" and "getPropertyValues" work.
> >>
> >>
> >> 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
>
>


-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Jürgen Schmidt <jo...@gmail.com>.
Hi Rajath,

first of all sorry for not answering over the weekend but I try to take
a "real" break over the weekend and focus on some private work items.

But Ariel gave you very detailed and good advice, it seems that he would
be a better mentor ;-)

The office API will be of course the more difficult part of this project
because you won't find so much documentation and samples as for Java.
The UCB is a special candidate in the office API and it takes some time
to understand it. Exception are playing a special role in the context of
the UCB and you will learn this over time.

The SDK contains also an example showing the usage of the UCB API. But
it's a good idea to play around on your own and get some understanding
how it works.

Juergen




On 6/3/13 6:59 AM, Rajath Shashidhara wrote:
> Hello Ariel,
> 
> Actually, this is my first code using openoffice api.
> I'll do these before completing my ucp.
> 
> Sorry. I'll get back to you with the understanding of the general api.
> 
> 
> On Mon, Jun 3, 2013 at 10:20 AM, Ariel Constenla-Haile <
> ariel.constenla.haile@gmail.com> wrote:
> 
>> Hi Rajath,
>>
>> On Mon, Jun 03, 2013 at 01:28:24AM +0530, Rajath Shashidhara wrote:
>>> Hello everyone,
>>>
>>> I have completed some part of the CMISUCP.
>>>
>>> I have made my own implementation of XContent, XContentIdentifier
>>> interfaces.
>>>
>>> I have partially Completed implementation of the following methods:
>>> queryContent()
>>> execute() -> "getPropertyValues", "open"
>>>
>>>
>>> I was not very clear about the return type of execute method.
>>> I might have erred there.
>>
>> In "open" you are returning a java.io.InputStream.  According to the API
>> documentation, "For non-folder objects, the OpenCommandArgument2 struct
>> will be prefilled with a data sink object, which will be filled with the
>> content data."; important point: "OpenCommandArgument::Sink: a sink,
>> where the implementation can put the document data into."
>>
>> And in "getPropertyValues" you are returning
>> a java.util.Map<String,String>. According to the API docs, the return
>> type is a ::com::sun::star::sdbc::XRow (as told in a previous mail).
>>
>> Both errors tell me you need a deeper knowledge of the UCB API: before
>> trying to implement your own UCP, you need a general understanding of
>> how the UCB API works, this is something fundamental, and these two
>> basic errors tell you are missing this point.
>>
>> So back to the basics:
>>
>> - create client application
>> - using the UCB API, get some properties of a file/folder
>> - if the content is a file, execute an "open" command. If the content is
>>   a folder, list its content.
>> - if the content is a file,
>>   a) store the stream to disk
>>   b) use the stream to load the file inside OpenOffice
>>
>> The code should work using local files/folders, http, webdav, etc. Try
>> with http://demo.owncloud.org/files/webdav.php so that you have to use
>> an interaction handler for authentication (user=test, password=test).
>>
>> This (together with reading the API reference) will give you a first
>> idea of how "open" and "getPropertyValues" work.
>>
>>
>> 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


Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello Ariel,

Actually, this is my first code using openoffice api.
I'll do these before completing my ucp.

Sorry. I'll get back to you with the understanding of the general api.


On Mon, Jun 3, 2013 at 10:20 AM, Ariel Constenla-Haile <
ariel.constenla.haile@gmail.com> wrote:

> Hi Rajath,
>
> On Mon, Jun 03, 2013 at 01:28:24AM +0530, Rajath Shashidhara wrote:
> > Hello everyone,
> >
> > I have completed some part of the CMISUCP.
> >
> > I have made my own implementation of XContent, XContentIdentifier
> > interfaces.
> >
> > I have partially Completed implementation of the following methods:
> > queryContent()
> > execute() -> "getPropertyValues", "open"
> >
> >
> > I was not very clear about the return type of execute method.
> > I might have erred there.
>
> In "open" you are returning a java.io.InputStream.  According to the API
> documentation, "For non-folder objects, the OpenCommandArgument2 struct
> will be prefilled with a data sink object, which will be filled with the
> content data."; important point: "OpenCommandArgument::Sink: a sink,
> where the implementation can put the document data into."
>
> And in "getPropertyValues" you are returning
> a java.util.Map<String,String>. According to the API docs, the return
> type is a ::com::sun::star::sdbc::XRow (as told in a previous mail).
>
> Both errors tell me you need a deeper knowledge of the UCB API: before
> trying to implement your own UCP, you need a general understanding of
> how the UCB API works, this is something fundamental, and these two
> basic errors tell you are missing this point.
>
> So back to the basics:
>
> - create client application
> - using the UCB API, get some properties of a file/folder
> - if the content is a file, execute an "open" command. If the content is
>   a folder, list its content.
> - if the content is a file,
>   a) store the stream to disk
>   b) use the stream to load the file inside OpenOffice
>
> The code should work using local files/folders, http, webdav, etc. Try
> with http://demo.owncloud.org/files/webdav.php so that you have to use
> an interaction handler for authentication (user=test, password=test).
>
> This (together with reading the API reference) will give you a first
> idea of how "open" and "getPropertyValues" work.
>
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Ariel Constenla-Haile <ar...@gmail.com>.
Hi Rajath,

On Mon, Jun 03, 2013 at 01:28:24AM +0530, Rajath Shashidhara wrote:
> Hello everyone,
> 
> I have completed some part of the CMISUCP.
> 
> I have made my own implementation of XContent, XContentIdentifier
> interfaces.
> 
> I have partially Completed implementation of the following methods:
> queryContent()
> execute() -> "getPropertyValues", "open"
> 
> 
> I was not very clear about the return type of execute method.
> I might have erred there.

In "open" you are returning a java.io.InputStream.  According to the API
documentation, "For non-folder objects, the OpenCommandArgument2 struct
will be prefilled with a data sink object, which will be filled with the
content data."; important point: "OpenCommandArgument::Sink: a sink,
where the implementation can put the document data into."

And in "getPropertyValues" you are returning
a java.util.Map<String,String>. According to the API docs, the return
type is a ::com::sun::star::sdbc::XRow (as told in a previous mail).

Both errors tell me you need a deeper knowledge of the UCB API: before
trying to implement your own UCP, you need a general understanding of
how the UCB API works, this is something fundamental, and these two
basic errors tell you are missing this point.

So back to the basics:

- create client application
- using the UCB API, get some properties of a file/folder
- if the content is a file, execute an "open" command. If the content is
  a folder, list its content.
- if the content is a file, 
  a) store the stream to disk
  b) use the stream to load the file inside OpenOffice

The code should work using local files/folders, http, webdav, etc. Try
with http://demo.owncloud.org/files/webdav.php so that you have to use
an interaction handler for authentication (user=test, password=test).

This (together with reading the API reference) will give you a first
idea of how "open" and "getPropertyValues" work.


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello everyone,

I have completed some part of the CMISUCP.

I have made my own implementation of XContent, XContentIdentifier
interfaces.

I have partially Completed implementation of the following methods:
queryContent()
execute() -> "getPropertyValues", "open"


I was not very clear about the return type of execute method.
I might have erred there.

for "open", I have created an InputStream object for the specified object,
but since a .odt file is different from text/plain type, the InputStream
gives scrambled output.

This works for the inmemory repo.
The server address, repo id, username, passwd can be changed in the
apache.ooffice.gsoc.cmisucp.cmis.repositoryconnect class.

Please give some pointers about my code.

My code is hosted on my github repository:
https://github.com/rajaths589/CMISContentProvider.git




On Sun, Jun 2, 2013 at 11:06 PM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Hello Ariel,
>
> function:
> compareContentIds
> Description:
> 0 is returned, if the identifiers are equal. A value less than 0indiactes, that the Id1 is less than Id2. A value greater than
> 0 is returned, if Id1 is greater than Id2.
>
> What is less than?
> Is it below in the file hierarchy? Are alphabetic?
>
>
> On Sun, Jun 2, 2013 at 8:20 PM, Rajath Shashidhara <
> rajaths.rajaths@gmail.com> wrote:
>
>> Just realised my mistake,
>> XContentIdentifier will be passed to queryContent. So, analysis of URL is
>> done in that method itself.
>>
>>
>> On Sun, Jun 2, 2013 at 5:12 PM, Rajath Shashidhara <
>> rajaths.rajaths@gmail.com> 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.
>>>
>>> I have not understood the basic way of obtaining the path of the object
>>> that is being referred to get the metadata of it.
>>> Also, is the argument in the Command refer to which property is being
>>> referred?
>>>
>>> Please help.
>>>
>>>
>>> On Sun, Jun 2, 2013 at 3:51 PM, Rajath Shashidhara <
>>> rajaths.rajaths@gmail.com> wrote:
>>>
>>>> Yes. I built it myself.
>>>> I'll rebuild it with that switch.
>>>> Thanks.
>>>>
>>>>
>>>> On Sun, Jun 2, 2013 at 3:50 PM, Ariel Constenla-Haile <
>>>> arielch@apache.org> wrote:
>>>>
>>>>> On Sun, Jun 02, 2013 at 03:21:42PM +0530, Rajath Shashidhara wrote:
>>>>> > Hello,
>>>>> >
>>>>> > I think there is a bug in OpenOffice 4. Tools->Options->Security.
>>>>> > Macro Security Button link is broken.
>>>>>
>>>>> Did you build it yourself? You have to enable category-b (configure
>>>>> with
>>>>> --enable-category-b ) for that dialog to work.
>>>>>
>>>>>
>>>>> Regards
>>>>> --
>>>>> Ariel Constenla-Haile
>>>>> La Plata, Argentina
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Rajath S,
>>>> M.Sc(Hons.) Physics,
>>>> Birla Institute of Technology and Science - Pilani,
>>>> Pilani
>>>>
>>>
>>>
>>>
>>> --
>>> Rajath S,
>>> M.Sc(Hons.) Physics,
>>> Birla Institute of Technology and Science - Pilani,
>>> Pilani
>>>
>>
>>
>>
>> --
>> Rajath S,
>> M.Sc(Hons.) Physics,
>> Birla Institute of Technology and Science - Pilani,
>> Pilani
>>
>
>
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello Ariel,

function:
compareContentIds
Description:
0 is returned, if the identifiers are equal. A value less than 0 indiactes,
that the Id1 is less than Id2. A value greater than 0 is returned, if Id1
is greater than Id2.

What is less than?
Is it below in the file hierarchy? Are alphabetic?


On Sun, Jun 2, 2013 at 8:20 PM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Just realised my mistake,
> XContentIdentifier will be passed to queryContent. So, analysis of URL is
> done in that method itself.
>
>
> On Sun, Jun 2, 2013 at 5:12 PM, Rajath Shashidhara <
> rajaths.rajaths@gmail.com> 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.
>>
>> I have not understood the basic way of obtaining the path of the object
>> that is being referred to get the metadata of it.
>> Also, is the argument in the Command refer to which property is being
>> referred?
>>
>> Please help.
>>
>>
>> On Sun, Jun 2, 2013 at 3:51 PM, Rajath Shashidhara <
>> rajaths.rajaths@gmail.com> wrote:
>>
>>> Yes. I built it myself.
>>> I'll rebuild it with that switch.
>>> Thanks.
>>>
>>>
>>> On Sun, Jun 2, 2013 at 3:50 PM, Ariel Constenla-Haile <
>>> arielch@apache.org> wrote:
>>>
>>>> On Sun, Jun 02, 2013 at 03:21:42PM +0530, Rajath Shashidhara wrote:
>>>> > Hello,
>>>> >
>>>> > I think there is a bug in OpenOffice 4. Tools->Options->Security.
>>>> > Macro Security Button link is broken.
>>>>
>>>> Did you build it yourself? You have to enable category-b (configure with
>>>> --enable-category-b ) for that dialog to work.
>>>>
>>>>
>>>> Regards
>>>> --
>>>> Ariel Constenla-Haile
>>>> La Plata, Argentina
>>>>
>>>
>>>
>>>
>>> --
>>> Rajath S,
>>> M.Sc(Hons.) Physics,
>>> Birla Institute of Technology and Science - Pilani,
>>> Pilani
>>>
>>
>>
>>
>> --
>> Rajath S,
>> M.Sc(Hons.) Physics,
>> Birla Institute of Technology and Science - Pilani,
>> Pilani
>>
>
>
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Just realised my mistake,
XContentIdentifier will be passed to queryContent. So, analysis of URL is
done in that method itself.


On Sun, Jun 2, 2013 at 5:12 PM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> 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.
>
> I have not understood the basic way of obtaining the path of the object
> that is being referred to get the metadata of it.
> Also, is the argument in the Command refer to which property is being
> referred?
>
> Please help.
>
>
> On Sun, Jun 2, 2013 at 3:51 PM, Rajath Shashidhara <
> rajaths.rajaths@gmail.com> wrote:
>
>> Yes. I built it myself.
>> I'll rebuild it with that switch.
>> Thanks.
>>
>>
>> On Sun, Jun 2, 2013 at 3:50 PM, Ariel Constenla-Haile <arielch@apache.org
>> > wrote:
>>
>>> On Sun, Jun 02, 2013 at 03:21:42PM +0530, Rajath Shashidhara wrote:
>>> > Hello,
>>> >
>>> > I think there is a bug in OpenOffice 4. Tools->Options->Security.
>>> > Macro Security Button link is broken.
>>>
>>> Did you build it yourself? You have to enable category-b (configure with
>>> --enable-category-b ) for that dialog to work.
>>>
>>>
>>> Regards
>>> --
>>> Ariel Constenla-Haile
>>> La Plata, Argentina
>>>
>>
>>
>>
>> --
>> Rajath S,
>> M.Sc(Hons.) Physics,
>> Birla Institute of Technology and Science - Pilani,
>> Pilani
>>
>
>
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Fwd: CMIS UCP

Posted by Ariel Constenla-Haile <ar...@gmail.com>.
It seems Apache SMTP service is failing, forwarding via my gmail account.


---------- Forwarded message ----------
From: Ariel Constenla-Haile <ar...@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


Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
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.

I have not understood the basic way of obtaining the path of the object
that is being referred to get the metadata of it.
Also, is the argument in the Command refer to which property is being
referred?

Please help.


On Sun, Jun 2, 2013 at 3:51 PM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Yes. I built it myself.
> I'll rebuild it with that switch.
> Thanks.
>
>
> On Sun, Jun 2, 2013 at 3:50 PM, Ariel Constenla-Haile <ar...@apache.org>wrote:
>
>> On Sun, Jun 02, 2013 at 03:21:42PM +0530, Rajath Shashidhara wrote:
>> > Hello,
>> >
>> > I think there is a bug in OpenOffice 4. Tools->Options->Security.
>> > Macro Security Button link is broken.
>>
>> Did you build it yourself? You have to enable category-b (configure with
>> --enable-category-b ) for that dialog to work.
>>
>>
>> Regards
>> --
>> Ariel Constenla-Haile
>> La Plata, Argentina
>>
>
>
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Yes. I built it myself.
I'll rebuild it with that switch.
Thanks.


On Sun, Jun 2, 2013 at 3:50 PM, Ariel Constenla-Haile <ar...@apache.org>wrote:

> On Sun, Jun 02, 2013 at 03:21:42PM +0530, Rajath Shashidhara wrote:
> > Hello,
> >
> > I think there is a bug in OpenOffice 4. Tools->Options->Security.
> > Macro Security Button link is broken.
>
> Did you build it yourself? You have to enable category-b (configure with
> --enable-category-b ) for that dialog to work.
>
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Ariel Constenla-Haile <ar...@apache.org>.
On Sun, Jun 02, 2013 at 03:21:42PM +0530, Rajath Shashidhara wrote:
> Hello,
> 
> I think there is a bug in OpenOffice 4. Tools->Options->Security.
> Macro Security Button link is broken.

Did you build it yourself? You have to enable category-b (configure with
--enable-category-b ) for that dialog to work.


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello,

I think there is a bug in OpenOffice 4. Tools->Options->Security.
Macro Security Button link is broken.



On Sun, Jun 2, 2013 at 2:03 PM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> wrote:

> Hello,
>
> Sorry for asking too many questions.
> The method execute in the XContent implementation class I have created,
> which has parameters: com.sun.star.ucb.Command aCommand, int CommandId,
> com.sun.star.ucb.XCommandEnvironment Environment
>
> now aCommand object has three attributes:
> Name,handle,argument
>
> So if trying to get Metadata. we use command as getPropertyValues.
> "getPropertyValues" is the name of the command,
> argument -> which property to get.
> What is handle?
>
> Also what is commandid? Any enumeration to represent various commandids?
>
>
>
> On Sun, Jun 2, 2013 at 12:06 PM, Ariel Constenla-Haile <arielch@apache.org
> > wrote:
>
>>
>> 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, com.sun.star.ucb.XContentIdentifier 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.
>>
>> http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/XContentIdentifier.html
>>
>>
>> > 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 =
>> com.sun.star.container.EnumerableMap.create("string","com.sun.star.ucb.XContentIdentifier")
>>
>>     Dim oUCB as Object
>>     oUCB = CreateUnoService("com.sun.star.ucb.UniversalContentBroker")
>>
>>     Dim sIds()
>>     sIds = Array(_
>>         "file:///tmp",_
>>         "http://www.openoffice.org",_
>>         "ftp://demo@openoffice.org/test/dummy",_
>>         "cmis://cmis.alfresco.com:80/cmisatom/" )
>>     Dim sId$
>>     For Each sId in sIds
>>         aMap.put( sId, oUCB.createContentIdentifier( sId ) )
>>     Next
>>
>>     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()
>>     Wend
>> 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
>>         registerNewContent(aContent);
>>
>>         return aContent;
>>     }
>>
>>
>> Regards
>> --
>> Ariel Constenla-Haile
>> La Plata, Argentina
>>
>
>
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
Hello,

Sorry for asking too many questions.
The method execute in the XContent implementation class I have created,
which has parameters: com.sun.star.ucb.Command aCommand, int CommandId,
com.sun.star.ucb.XCommandEnvironment Environment

now aCommand object has three attributes:
Name,handle,argument

So if trying to get Metadata. we use command as getPropertyValues.
"getPropertyValues" is the name of the command,
argument -> which property to get.
What is handle?

Also what is commandid? Any enumeration to represent various commandids?



On Sun, Jun 2, 2013 at 12:06 PM, Ariel Constenla-Haile
<ar...@apache.org>wrote:

>
> 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, com.sun.star.ucb.XContentIdentifier 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.
>
> http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/XContentIdentifier.html
>
>
> > 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 =
> com.sun.star.container.EnumerableMap.create("string","com.sun.star.ucb.XContentIdentifier")
>
>     Dim oUCB as Object
>     oUCB = CreateUnoService("com.sun.star.ucb.UniversalContentBroker")
>
>     Dim sIds()
>     sIds = Array(_
>         "file:///tmp",_
>         "http://www.openoffice.org",_
>         "ftp://demo@openoffice.org/test/dummy",_
>         "cmis://cmis.alfresco.com:80/cmisatom/" )
>     Dim sId$
>     For Each sId in sIds
>         aMap.put( sId, oUCB.createContentIdentifier( sId ) )
>     Next
>
>     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()
>     Wend
> 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
>         registerNewContent(aContent);
>
>         return aContent;
>     }
>
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Ariel Constenla-Haile <ar...@apache.org>.
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, com.sun.star.ucb.XContentIdentifier 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.
http://www.openoffice.org/api/docs/common/ref/com/sun/star/ucb/XContentIdentifier.html


> 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 = com.sun.star.container.EnumerableMap.create("string","com.sun.star.ucb.XContentIdentifier")

    Dim oUCB as Object
    oUCB = CreateUnoService("com.sun.star.ucb.UniversalContentBroker")

    Dim sIds()
    sIds = Array(_
        "file:///tmp",_
        "http://www.openoffice.org",_
        "ftp://demo@openoffice.org/test/dummy",_
        "cmis://cmis.alfresco.com:80/cmisatom/" )
    Dim sId$
    For Each sId in sIds
        aMap.put( sId, oUCB.createContentIdentifier( sId ) )
    Next

    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()
    Wend
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
        registerNewContent(aContent);

        return aContent;
    }


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
This is the getContentProviderScheme() implementation for ftp:

rtl::OUString SAL_CALL
FTPContentIdentifier::getContentProviderScheme(
)
    throw (
        com::sun::star::uno::RuntimeException
    )
{
    return rtl::OUString::createFromAscii("ftp");
}

So should I return a string "cmis"
?



On Sun, Jun 2, 2013 at 9:58 AM, Rajath Shashidhara <
rajaths.rajaths@gmail.com> 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, com.sun.star.ucb.XContentIdentifier getIdentifier() is one
> of them.
> I have read the api reference for XContentIdentifier.
>
> It needs XComponentContext as an argument for its 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> ?
>
>
>
>
> On Sun, Jun 2, 2013 at 6:06 AM, Ariel Constenla-Haile <ar...@apache.org>wrote:
>
>> 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
>>
>
>
>
> --
> Rajath S,
> M.Sc(Hons.) Physics,
> Birla Institute of Technology and Science - Pilani,
> Pilani
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
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, com.sun.star.ucb.XContentIdentifier getIdentifier() is one of
them.
I have read the api reference for XContentIdentifier.

It needs XComponentContext as an argument for its 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> ?




On Sun, Jun 2, 2013 at 6:06 AM, Ariel Constenla-Haile <ar...@apache.org>wrote:

> 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
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Ariel Constenla-Haile <ar...@apache.org>.
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

Re: CMIS UCP

Posted by Rajath Shashidhara <ra...@gmail.com>.
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?


On Sat, Jun 1, 2013 at 10:34 PM, Ariel Constenla-Haile
<ar...@apache.org>wrote:

> Hi Rajath,
>
> On Sat, Jun 01, 2013 at 09:05:34PM +0530, Rajath Shashidhara wrote:
> > Hello Ariel,
> >
> > Your code has these lines in queryContent() method:
> > System.out.printf("queryContent()\n");
> > System.out.printf("Identifier: %s\n",
> xIdentifier.getContentIdentifier());
> > System.out.printf("Scheme: \n", xIdentifier.getContentProviderScheme());
> >
> > So, when I try to open a file from CMIS repository,
> > does it mean that these print statements should be executed?
> > So, I will be able to see the print statements on the terminal when I
> start
> > openoffice from terminal?
>
> This is just for dummy debugging, you have to avoid printing to standard
> output in your final extension, use a logger instead or AOO logging API.
>
>
> Regards
> --
> Ariel Constenla-Haile
> La Plata, Argentina
>



-- 
Rajath S,
M.Sc(Hons.) Physics,
Birla Institute of Technology and Science - Pilani,
Pilani

Re: CMIS UCP

Posted by Ariel Constenla-Haile <ar...@apache.org>.
Hi Rajath,

On Sat, Jun 01, 2013 at 09:05:34PM +0530, Rajath Shashidhara wrote:
> Hello Ariel,
> 
> Your code has these lines in queryContent() method:
> System.out.printf("queryContent()\n");
> System.out.printf("Identifier: %s\n", xIdentifier.getContentIdentifier());
> System.out.printf("Scheme: \n", xIdentifier.getContentProviderScheme());
> 
> So, when I try to open a file from CMIS repository,
> does it mean that these print statements should be executed?
> So, I will be able to see the print statements on the terminal when I start
> openoffice from terminal?

This is just for dummy debugging, you have to avoid printing to standard
output in your final extension, use a logger instead or AOO logging API.


Regards
-- 
Ariel Constenla-Haile
La Plata, Argentina