1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_desktop.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <cppuhelper/implbase3.hxx> 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir #include "comphelper/servicedecl.hxx" 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include "com/sun/star/deployment/UpdateInformationProvider.hpp" 36*cdf0e10cSrcweir #include "com/sun/star/deployment/XPackage.hpp" 37*cdf0e10cSrcweir #include "com/sun/star/deployment/XPackageInformationProvider.hpp" 38*cdf0e10cSrcweir #include "com/sun/star/deployment/ExtensionManager.hpp" 39*cdf0e10cSrcweir #include "com/sun/star/deployment/XUpdateInformationProvider.hpp" 40*cdf0e10cSrcweir #include "com/sun/star/lang/XServiceInfo.hpp" 41*cdf0e10cSrcweir #include "com/sun/star/registry/XRegistryKey.hpp" 42*cdf0e10cSrcweir #include "com/sun/star/task/XAbortChannel.hpp" 43*cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp" 44*cdf0e10cSrcweir #include "com/sun/star/ucb/XCommandEnvironment.hpp" 45*cdf0e10cSrcweir #include "com/sun/star/xml/dom/XElement.hpp" 46*cdf0e10cSrcweir #include "com/sun/star/xml/dom/XNode.hpp" 47*cdf0e10cSrcweir 48*cdf0e10cSrcweir #include "com/sun/star/uno/Reference.hxx" 49*cdf0e10cSrcweir #include "rtl/ustring.hxx" 50*cdf0e10cSrcweir #include "ucbhelper/content.hxx" 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir #include "dp_dependencies.hxx" 53*cdf0e10cSrcweir #include "dp_descriptioninfoset.hxx" 54*cdf0e10cSrcweir #include "dp_identifier.hxx" 55*cdf0e10cSrcweir #include "dp_version.hxx" 56*cdf0e10cSrcweir #include "dp_misc.h" 57*cdf0e10cSrcweir #include "dp_update.hxx" 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir namespace beans = com::sun::star::beans ; 60*cdf0e10cSrcweir namespace deployment = com::sun::star::deployment ; 61*cdf0e10cSrcweir namespace lang = com::sun::star::lang ; 62*cdf0e10cSrcweir namespace registry = com::sun::star::registry ; 63*cdf0e10cSrcweir namespace task = com::sun::star::task ; 64*cdf0e10cSrcweir namespace css_ucb = com::sun::star::ucb ; 65*cdf0e10cSrcweir namespace uno = com::sun::star::uno ; 66*cdf0e10cSrcweir namespace xml = com::sun::star::xml ; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir #define UNISTRING(s) rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(s)) 69*cdf0e10cSrcweir 70*cdf0e10cSrcweir namespace dp_info { 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir class PackageInformationProvider : 73*cdf0e10cSrcweir public ::cppu::WeakImplHelper1< deployment::XPackageInformationProvider > 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir { 76*cdf0e10cSrcweir public: 77*cdf0e10cSrcweir PackageInformationProvider( uno::Reference< uno::XComponentContext >const& xContext); 78*cdf0e10cSrcweir virtual ~PackageInformationProvider(); 79*cdf0e10cSrcweir 80*cdf0e10cSrcweir static uno::Sequence< rtl::OUString > getServiceNames(); 81*cdf0e10cSrcweir static rtl::OUString getImplName(); 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir // XPackageInformationProvider 84*cdf0e10cSrcweir virtual rtl::OUString SAL_CALL getPackageLocation( const rtl::OUString& extensionId ) 85*cdf0e10cSrcweir throw ( uno::RuntimeException ); 86*cdf0e10cSrcweir virtual uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL isUpdateAvailable( const rtl::OUString& extensionId ) 87*cdf0e10cSrcweir throw ( uno::RuntimeException ); 88*cdf0e10cSrcweir virtual uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL getExtensionList() 89*cdf0e10cSrcweir throw ( uno::RuntimeException ); 90*cdf0e10cSrcweir //--------- 91*cdf0e10cSrcweir private: 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir uno::Reference< uno::XComponentContext> mxContext; 94*cdf0e10cSrcweir 95*cdf0e10cSrcweir rtl::OUString getPackageLocation( const rtl::OUString& repository, 96*cdf0e10cSrcweir const rtl::OUString& _sExtensionId ); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir uno::Reference< deployment::XUpdateInformationProvider > mxUpdateInformation; 99*cdf0e10cSrcweir }; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir //------------------------------------------------------------------------------ 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir PackageInformationProvider::PackageInformationProvider( uno::Reference< uno::XComponentContext > const& xContext) : 104*cdf0e10cSrcweir mxContext( xContext ), 105*cdf0e10cSrcweir mxUpdateInformation( deployment::UpdateInformationProvider::create( xContext ) ) 106*cdf0e10cSrcweir { 107*cdf0e10cSrcweir } 108*cdf0e10cSrcweir 109*cdf0e10cSrcweir //------------------------------------------------------------------------------ 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir PackageInformationProvider::~PackageInformationProvider() 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir } 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir //------------------------------------------------------------------------------ 116*cdf0e10cSrcweir rtl::OUString PackageInformationProvider::getPackageLocation( 117*cdf0e10cSrcweir const rtl::OUString & repository, 118*cdf0e10cSrcweir const rtl::OUString& _rExtensionId ) 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir rtl::OUString aLocationURL; 121*cdf0e10cSrcweir uno::Reference<deployment::XExtensionManager> xManager = 122*cdf0e10cSrcweir deployment::ExtensionManager::get(mxContext); 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir if ( xManager.is() ) 125*cdf0e10cSrcweir { 126*cdf0e10cSrcweir const uno::Sequence< uno::Reference< deployment::XPackage > > packages( 127*cdf0e10cSrcweir xManager->getDeployedExtensions( 128*cdf0e10cSrcweir repository, 129*cdf0e10cSrcweir uno::Reference< task::XAbortChannel >(), 130*cdf0e10cSrcweir uno::Reference< css_ucb::XCommandEnvironment > () ) ); 131*cdf0e10cSrcweir 132*cdf0e10cSrcweir for ( int pos = packages.getLength(); pos--; ) 133*cdf0e10cSrcweir { 134*cdf0e10cSrcweir try 135*cdf0e10cSrcweir { 136*cdf0e10cSrcweir const rtl::OUString aName = packages[ pos ]->getName(); 137*cdf0e10cSrcweir const beans::Optional< rtl::OUString > aID = packages[ pos ]->getIdentifier(); 138*cdf0e10cSrcweir if ( aID.IsPresent && aID.Value.compareTo( _rExtensionId ) == 0 ) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir aLocationURL = packages[ pos ]->getURL(); 141*cdf0e10cSrcweir break; 142*cdf0e10cSrcweir } 143*cdf0e10cSrcweir } 144*cdf0e10cSrcweir catch ( uno::RuntimeException & ) {} 145*cdf0e10cSrcweir } 146*cdf0e10cSrcweir } 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir return aLocationURL; 149*cdf0e10cSrcweir } 150*cdf0e10cSrcweir 151*cdf0e10cSrcweir //------------------------------------------------------------------------------ 152*cdf0e10cSrcweir //------------------------------------------------------------------------------ 153*cdf0e10cSrcweir //------------------------------------------------------------------------------ 154*cdf0e10cSrcweir 155*cdf0e10cSrcweir rtl::OUString SAL_CALL 156*cdf0e10cSrcweir PackageInformationProvider::getPackageLocation( const rtl::OUString& _sExtensionId ) 157*cdf0e10cSrcweir throw ( uno::RuntimeException ) 158*cdf0e10cSrcweir { 159*cdf0e10cSrcweir rtl::OUString aLocationURL = getPackageLocation( UNISTRING("user"), _sExtensionId ); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir if ( aLocationURL.getLength() == 0 ) 162*cdf0e10cSrcweir { 163*cdf0e10cSrcweir aLocationURL = getPackageLocation( UNISTRING("shared"), _sExtensionId ); 164*cdf0e10cSrcweir } 165*cdf0e10cSrcweir if ( aLocationURL.getLength() == 0 ) 166*cdf0e10cSrcweir { 167*cdf0e10cSrcweir aLocationURL = getPackageLocation( UNISTRING("bundled"), _sExtensionId ); 168*cdf0e10cSrcweir } 169*cdf0e10cSrcweir if ( aLocationURL.getLength() ) 170*cdf0e10cSrcweir { 171*cdf0e10cSrcweir ::ucbhelper::Content aContent( aLocationURL, NULL ); 172*cdf0e10cSrcweir aLocationURL = aContent.getURL(); 173*cdf0e10cSrcweir } 174*cdf0e10cSrcweir return aLocationURL; 175*cdf0e10cSrcweir } 176*cdf0e10cSrcweir 177*cdf0e10cSrcweir //------------------------------------------------------------------------------ 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL 180*cdf0e10cSrcweir PackageInformationProvider::isUpdateAvailable( const rtl::OUString& _sExtensionId ) 181*cdf0e10cSrcweir throw ( uno::RuntimeException ) 182*cdf0e10cSrcweir { 183*cdf0e10cSrcweir uno::Sequence< uno::Sequence< rtl::OUString > > aList; 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir uno::Reference<deployment::XExtensionManager> extMgr = 186*cdf0e10cSrcweir deployment::ExtensionManager::get(mxContext); 187*cdf0e10cSrcweir 188*cdf0e10cSrcweir if (!extMgr.is()) 189*cdf0e10cSrcweir { 190*cdf0e10cSrcweir OSL_ASSERT(0); 191*cdf0e10cSrcweir return aList; 192*cdf0e10cSrcweir } 193*cdf0e10cSrcweir std::vector<std::pair<uno::Reference<deployment::XPackage>, uno::Any > > errors; 194*cdf0e10cSrcweir dp_misc::UpdateInfoMap updateInfoMap; 195*cdf0e10cSrcweir if (_sExtensionId.getLength()) 196*cdf0e10cSrcweir { 197*cdf0e10cSrcweir std::vector<uno::Reference<deployment::XPackage> > vecExtensions; 198*cdf0e10cSrcweir uno::Reference<deployment::XPackage> extension; 199*cdf0e10cSrcweir try 200*cdf0e10cSrcweir { 201*cdf0e10cSrcweir extension = dp_misc::getExtensionWithHighestVersion( 202*cdf0e10cSrcweir extMgr->getExtensionsWithSameIdentifier( 203*cdf0e10cSrcweir _sExtensionId, _sExtensionId, uno::Reference<css_ucb::XCommandEnvironment>())); 204*cdf0e10cSrcweir vecExtensions.push_back(extension); 205*cdf0e10cSrcweir } 206*cdf0e10cSrcweir catch (lang::IllegalArgumentException &) 207*cdf0e10cSrcweir { 208*cdf0e10cSrcweir OSL_ASSERT(0); 209*cdf0e10cSrcweir } 210*cdf0e10cSrcweir updateInfoMap = dp_misc::getOnlineUpdateInfos( 211*cdf0e10cSrcweir mxContext, extMgr, mxUpdateInformation, &vecExtensions, errors); 212*cdf0e10cSrcweir } 213*cdf0e10cSrcweir else 214*cdf0e10cSrcweir { 215*cdf0e10cSrcweir updateInfoMap = dp_misc::getOnlineUpdateInfos( 216*cdf0e10cSrcweir mxContext, extMgr, mxUpdateInformation, NULL, errors); 217*cdf0e10cSrcweir } 218*cdf0e10cSrcweir 219*cdf0e10cSrcweir int nCount = 0; 220*cdf0e10cSrcweir for (dp_misc::UpdateInfoMap::iterator i(updateInfoMap.begin()); i != updateInfoMap.end(); i++) 221*cdf0e10cSrcweir { 222*cdf0e10cSrcweir dp_misc::UpdateInfo const & info = i->second; 223*cdf0e10cSrcweir 224*cdf0e10cSrcweir rtl::OUString sOnlineVersion; 225*cdf0e10cSrcweir if (info.info.is()) 226*cdf0e10cSrcweir { 227*cdf0e10cSrcweir // check, if there are unsatisfied dependencies and ignore this online update 228*cdf0e10cSrcweir dp_misc::DescriptionInfoset infoset(mxContext, info.info); 229*cdf0e10cSrcweir uno::Sequence< uno::Reference< xml::dom::XElement > > 230*cdf0e10cSrcweir ds( dp_misc::Dependencies::check( infoset ) ); 231*cdf0e10cSrcweir if ( ! ds.getLength() ) 232*cdf0e10cSrcweir sOnlineVersion = info.version; 233*cdf0e10cSrcweir } 234*cdf0e10cSrcweir 235*cdf0e10cSrcweir rtl::OUString sVersionUser; 236*cdf0e10cSrcweir rtl::OUString sVersionShared; 237*cdf0e10cSrcweir rtl::OUString sVersionBundled; 238*cdf0e10cSrcweir uno::Sequence< uno::Reference< deployment::XPackage> > extensions; 239*cdf0e10cSrcweir try { 240*cdf0e10cSrcweir extensions = extMgr->getExtensionsWithSameIdentifier( 241*cdf0e10cSrcweir dp_misc::getIdentifier(info.extension), info.extension->getName(), 242*cdf0e10cSrcweir uno::Reference<css_ucb::XCommandEnvironment>()); 243*cdf0e10cSrcweir } catch (lang::IllegalArgumentException& ) { 244*cdf0e10cSrcweir OSL_ASSERT(0); 245*cdf0e10cSrcweir } 246*cdf0e10cSrcweir OSL_ASSERT(extensions.getLength() == 3); 247*cdf0e10cSrcweir if (extensions[0].is() ) 248*cdf0e10cSrcweir sVersionUser = extensions[0]->getVersion(); 249*cdf0e10cSrcweir if (extensions[1].is() ) 250*cdf0e10cSrcweir sVersionShared = extensions[1]->getVersion(); 251*cdf0e10cSrcweir if (extensions[2].is() ) 252*cdf0e10cSrcweir sVersionBundled = extensions[2]->getVersion(); 253*cdf0e10cSrcweir 254*cdf0e10cSrcweir bool bSharedReadOnly = extMgr->isReadOnlyRepository(OUSTR("shared")); 255*cdf0e10cSrcweir 256*cdf0e10cSrcweir dp_misc::UPDATE_SOURCE sourceUser = dp_misc::isUpdateUserExtension( 257*cdf0e10cSrcweir bSharedReadOnly, sVersionUser, sVersionShared, sVersionBundled, sOnlineVersion); 258*cdf0e10cSrcweir dp_misc::UPDATE_SOURCE sourceShared = dp_misc::isUpdateSharedExtension( 259*cdf0e10cSrcweir bSharedReadOnly, sVersionShared, sVersionBundled, sOnlineVersion); 260*cdf0e10cSrcweir 261*cdf0e10cSrcweir rtl::OUString updateVersionUser; 262*cdf0e10cSrcweir rtl::OUString updateVersionShared; 263*cdf0e10cSrcweir if (sourceUser != dp_misc::UPDATE_SOURCE_NONE) 264*cdf0e10cSrcweir updateVersionUser = dp_misc::getHighestVersion( 265*cdf0e10cSrcweir rtl::OUString(), sVersionShared, sVersionBundled, sOnlineVersion); 266*cdf0e10cSrcweir if (sourceShared != dp_misc::UPDATE_SOURCE_NONE) 267*cdf0e10cSrcweir updateVersionShared = dp_misc::getHighestVersion( 268*cdf0e10cSrcweir rtl::OUString(), rtl::OUString(), sVersionBundled, sOnlineVersion); 269*cdf0e10cSrcweir rtl::OUString updateVersion; 270*cdf0e10cSrcweir if (dp_misc::compareVersions(updateVersionUser, updateVersionShared) == dp_misc::GREATER) 271*cdf0e10cSrcweir updateVersion = updateVersionUser; 272*cdf0e10cSrcweir else 273*cdf0e10cSrcweir updateVersion = updateVersionShared; 274*cdf0e10cSrcweir if (updateVersion.getLength()) 275*cdf0e10cSrcweir { 276*cdf0e10cSrcweir 277*cdf0e10cSrcweir rtl::OUString aNewEntry[2]; 278*cdf0e10cSrcweir aNewEntry[0] = i->first; 279*cdf0e10cSrcweir aNewEntry[1] = updateVersion; 280*cdf0e10cSrcweir aList.realloc( ++nCount ); 281*cdf0e10cSrcweir aList[ nCount-1 ] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 ); 282*cdf0e10cSrcweir } 283*cdf0e10cSrcweir } 284*cdf0e10cSrcweir return aList; 285*cdf0e10cSrcweir } 286*cdf0e10cSrcweir 287*cdf0e10cSrcweir //------------------------------------------------------------------------------ 288*cdf0e10cSrcweir uno::Sequence< uno::Sequence< rtl::OUString > > SAL_CALL PackageInformationProvider::getExtensionList() 289*cdf0e10cSrcweir throw ( uno::RuntimeException ) 290*cdf0e10cSrcweir { 291*cdf0e10cSrcweir const uno::Reference<deployment::XExtensionManager> mgr = 292*cdf0e10cSrcweir deployment::ExtensionManager::get(mxContext); 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir if (!mgr.is()) 295*cdf0e10cSrcweir return uno::Sequence< uno::Sequence< rtl::OUString > >(); 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir const uno::Sequence< uno::Sequence< uno::Reference<deployment::XPackage > > > 298*cdf0e10cSrcweir allExt = mgr->getAllExtensions( 299*cdf0e10cSrcweir uno::Reference< task::XAbortChannel >(), 300*cdf0e10cSrcweir uno::Reference< css_ucb::XCommandEnvironment > () ); 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir uno::Sequence< uno::Sequence< rtl::OUString > > retList; 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir sal_Int32 cAllIds = allExt.getLength(); 305*cdf0e10cSrcweir retList.realloc(cAllIds); 306*cdf0e10cSrcweir 307*cdf0e10cSrcweir for (sal_Int32 i = 0; i < cAllIds; i++) 308*cdf0e10cSrcweir { 309*cdf0e10cSrcweir //The inner sequence contains extensions with the same identifier from 310*cdf0e10cSrcweir //all the different repositories, that is user, share, bundled. 311*cdf0e10cSrcweir const uno::Sequence< uno::Reference< deployment::XPackage > > & 312*cdf0e10cSrcweir seqExtension = allExt[i]; 313*cdf0e10cSrcweir sal_Int32 cExt = seqExtension.getLength(); 314*cdf0e10cSrcweir OSL_ASSERT(cExt == 3); 315*cdf0e10cSrcweir for (sal_Int32 j = 0; j < cExt; j++) 316*cdf0e10cSrcweir { 317*cdf0e10cSrcweir //ToDo according to the old code the first found extenions is used 318*cdf0e10cSrcweir //even if another one with the same id has a better version. 319*cdf0e10cSrcweir uno::Reference< deployment::XPackage > const & xExtension( seqExtension[j] ); 320*cdf0e10cSrcweir if (xExtension.is()) 321*cdf0e10cSrcweir { 322*cdf0e10cSrcweir rtl::OUString aNewEntry[2]; 323*cdf0e10cSrcweir aNewEntry[0] = dp_misc::getIdentifier(xExtension); 324*cdf0e10cSrcweir aNewEntry[1] = xExtension->getVersion(); 325*cdf0e10cSrcweir retList[i] = ::uno::Sequence< rtl::OUString >( aNewEntry, 2 ); 326*cdf0e10cSrcweir break; 327*cdf0e10cSrcweir } 328*cdf0e10cSrcweir } 329*cdf0e10cSrcweir } 330*cdf0e10cSrcweir return retList; 331*cdf0e10cSrcweir } 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir 334*cdf0e10cSrcweir //------------------------------------------------------------------------------ 335*cdf0e10cSrcweir //------------------------------------------------------------------------------ 336*cdf0e10cSrcweir //------------------------------------------------------------------------------ 337*cdf0e10cSrcweir 338*cdf0e10cSrcweir namespace sdecl = comphelper::service_decl; 339*cdf0e10cSrcweir sdecl::class_<PackageInformationProvider> servicePIP; 340*cdf0e10cSrcweir extern sdecl::ServiceDecl const serviceDecl( 341*cdf0e10cSrcweir servicePIP, 342*cdf0e10cSrcweir // a private one: 343*cdf0e10cSrcweir "com.sun.star.comp.deployment.PackageInformationProvider", 344*cdf0e10cSrcweir "com.sun.star.comp.deployment.PackageInformationProvider" ); 345*cdf0e10cSrcweir 346*cdf0e10cSrcweir //------------------------------------------------------------------------------ 347*cdf0e10cSrcweir bool singleton_entries( 348*cdf0e10cSrcweir uno::Reference< registry::XRegistryKey > const & xRegistryKey ) 349*cdf0e10cSrcweir { 350*cdf0e10cSrcweir try { 351*cdf0e10cSrcweir uno::Reference< registry::XRegistryKey > xKey( 352*cdf0e10cSrcweir xRegistryKey->createKey( 353*cdf0e10cSrcweir serviceDecl.getImplementationName() + 354*cdf0e10cSrcweir // xxx todo: use future generated function to get singleton name 355*cdf0e10cSrcweir UNISTRING("/UNO/SINGLETONS/" 356*cdf0e10cSrcweir "com.sun.star.deployment.PackageInformationProvider") ) ); 357*cdf0e10cSrcweir xKey->setStringValue( serviceDecl.getSupportedServiceNames()[0] ); 358*cdf0e10cSrcweir return true; 359*cdf0e10cSrcweir } 360*cdf0e10cSrcweir catch (registry::InvalidRegistryException & exc) { 361*cdf0e10cSrcweir (void) exc; // avoid warnings 362*cdf0e10cSrcweir OSL_ENSURE( 0, ::rtl::OUStringToOString( 363*cdf0e10cSrcweir exc.Message, RTL_TEXTENCODING_UTF8 ).getStr() ); 364*cdf0e10cSrcweir return false; 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir } 367*cdf0e10cSrcweir 368*cdf0e10cSrcweir } // namespace dp_info 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir 371