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