new-style service and create with arguments

Noel Grandin noel at peralex.com
Tue May 14 00:16:18 PDT 2013


Fixed in commit 3abe867790a1a896e30e9887546aef8b9e651b53

On 2013-05-14 08:37, Noel Grandin wrote:
> Hi
>
> Ooops, that would be my fault.
> I'll push a fix shortly.
> The IDL will look something like:
> service ConnectionTools : XConnectionTools
> {
>     createWithConnection([in] com::sun::star::sdbc::XConnection 
> Connection);
> };
>
> Regards, Noel.
>
> On 2013-05-14 08:21, Lionel Elie Mamane wrote:
>> Hi,
>>
>> With regards to adapting UNO services to "new style", the case of
>> com.sun.star.sdb.tools.ConnectionTools.
>>
>> It used to be invoked as follows (in file 
>> dbaccess/source/core/dataaccess/connection.cxx, method ):
>>
>>      m_xConnectionTools.set(
>> m_aContext->getServiceManager()->createInstanceWithArgumentsAndContext("com.sun.star.sdb.tools.ConnectionTools", 
>> aArguments, m_aContext),
>>          UNO_QUERY_THROW );
>>
>> The "convert to new style" commit 
>> (002aab309055b7feeeeeb25c1835b6abe6646729)
>>
>> changed that to:
>>
>>      m_xConnectionTools = css::sdb::tools::ConnectionTools::create( 
>> m_aContext );
>>
>> Which ignores aArguments, which creates a regression because
>> aArguments actually contained information that was needed...
>>
>> So, I've added:
>>
>>      assert(Reference< XInitialization >(m_xConnectionTools, 
>> UNO_QUERY).is());
>>      Reference< XInitialization > xInit(m_xConnectionTools, 
>> UNO_QUERY_THROW );
>>      xInit->initialize(aArguments);
>>
>> This seems to work.
>>
>> But my question is: is this the new idiomatic way to invoke a service
>> with arguments, or can I make some change to the newly-introduced
>> offapi/com/sun/star/sdb/tools/ConnectionTools.idl so that the service
>> has e.g. some createWithArguments method instead of only "create"? Or
>> is there some wrapper that will do the above xInit-dance for me or
>> some such?
>>
>


Disclaimer: http://www.peralex.com/disclaimer.html




More information about the LibreOffice mailing list