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
10*2722ceddSAndrew Rist  *
11*2722ceddSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2722ceddSAndrew Rist  *
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.
19*2722ceddSAndrew Rist  *
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 "rtl/string.h"
28cdf0e10cSrcweir #include "rtl/strbuf.hxx"
29cdf0e10cSrcweir #include "rtl/bootstrap.hxx"
30cdf0e10cSrcweir #include "cppuhelper/exc_hlp.hxx"
31cdf0e10cSrcweir #include "osl/file.hxx"
32cdf0e10cSrcweir #include "com/sun/star/uno/XComponentContext.hpp"
33cdf0e10cSrcweir #include "com/sun/star/xml/dom/XDocumentBuilder.hpp"
34cdf0e10cSrcweir #include "com/sun/star/xml/xpath/XXPathAPI.hpp"
35cdf0e10cSrcweir #include "com/sun/star/io/XActiveDataSource.hpp"
36cdf0e10cSrcweir #include "com/sun/star/io/XActiveDataControl.hpp"
37cdf0e10cSrcweir #include "dp_ucb.h"
38cdf0e10cSrcweir #include "dp_misc.h"
39cdf0e10cSrcweir #include "ucbhelper/content.hxx"
40cdf0e10cSrcweir #include "xmlscript/xml_helper.hxx"
41cdf0e10cSrcweir #include "dp_backenddb.hxx"
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir namespace css = ::com::sun::star;
45cdf0e10cSrcweir using namespace ::com::sun::star::uno;
46cdf0e10cSrcweir using ::rtl::OUString;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir namespace dp_registry {
50cdf0e10cSrcweir namespace backend {
51cdf0e10cSrcweir 
BackendDb(Reference<css::uno::XComponentContext> const & xContext,::rtl::OUString const & url)52cdf0e10cSrcweir BackendDb::BackendDb(
53cdf0e10cSrcweir     Reference<css::uno::XComponentContext> const &  xContext,
54cdf0e10cSrcweir     ::rtl::OUString const & url):
55cdf0e10cSrcweir     m_xContext(xContext)
56cdf0e10cSrcweir {
57cdf0e10cSrcweir     m_urlDb = dp_misc::expandUnoRcUrl(url);
58cdf0e10cSrcweir }
59cdf0e10cSrcweir 
save()60cdf0e10cSrcweir void BackendDb::save()
61cdf0e10cSrcweir {
62cdf0e10cSrcweir     const Reference<css::io::XActiveDataSource> xDataSource(m_doc,css::uno::UNO_QUERY_THROW);
63cdf0e10cSrcweir     ::rtl::ByteSequence bytes;
64cdf0e10cSrcweir     xDataSource->setOutputStream(::xmlscript::createOutputStream(&bytes));
65cdf0e10cSrcweir     const Reference<css::io::XActiveDataControl> xDataControl(m_doc,css::uno::UNO_QUERY_THROW);
66cdf0e10cSrcweir     xDataControl->start();
67cdf0e10cSrcweir 
68cdf0e10cSrcweir     const Reference<css::io::XInputStream> xData(
69cdf0e10cSrcweir         ::xmlscript::createInputStream(bytes));
70cdf0e10cSrcweir     ::ucbhelper::Content ucbDb(m_urlDb, 0);
71cdf0e10cSrcweir     ucbDb.writeStream(xData, true /*replace existing*/);
72cdf0e10cSrcweir }
73cdf0e10cSrcweir 
getDocument()74cdf0e10cSrcweir css::uno::Reference<css::xml::dom::XDocument> BackendDb::getDocument()
75cdf0e10cSrcweir {
76cdf0e10cSrcweir     if (!m_doc.is())
77cdf0e10cSrcweir     {
78cdf0e10cSrcweir         const Reference<css::xml::dom::XDocumentBuilder> xDocBuilder(
79cdf0e10cSrcweir             m_xContext->getServiceManager()->createInstanceWithContext(
80cdf0e10cSrcweir                 OUSTR("com.sun.star.xml.dom.DocumentBuilder"),
81cdf0e10cSrcweir                 m_xContext ), css::uno::UNO_QUERY);
82cdf0e10cSrcweir         if (!xDocBuilder.is())
83cdf0e10cSrcweir             throw css::uno::RuntimeException(
84cdf0e10cSrcweir                 OUSTR(" Could not create service com.sun.star.xml.dom.DocumentBuilder"), 0);
85cdf0e10cSrcweir 
86cdf0e10cSrcweir         ::osl::DirectoryItem item;
87cdf0e10cSrcweir         ::osl::File::RC err = ::osl::DirectoryItem::get(m_urlDb, item);
88cdf0e10cSrcweir         if (err == ::osl::File::E_None)
89cdf0e10cSrcweir         {
90cdf0e10cSrcweir             ::ucbhelper::Content descContent(
91cdf0e10cSrcweir                 m_urlDb, css::uno::Reference<css::ucb::XCommandEnvironment>());
92cdf0e10cSrcweir             Reference<css::io::XInputStream> xIn = descContent.openStream();
93cdf0e10cSrcweir             m_doc = xDocBuilder->parse(xIn);
94cdf0e10cSrcweir         }
95cdf0e10cSrcweir         else if (err == ::osl::File::E_NOENT)
96cdf0e10cSrcweir         {
97cdf0e10cSrcweir             //Create a new document and insert some basic stuff
98cdf0e10cSrcweir             m_doc = xDocBuilder->newDocument();
99cdf0e10cSrcweir             const Reference<css::xml::dom::XElement> rootNode =
100cdf0e10cSrcweir                 m_doc->createElementNS(getDbNSName(), getNSPrefix() +
101cdf0e10cSrcweir                                        OUSTR(":") + getRootElementName());
102cdf0e10cSrcweir 
103cdf0e10cSrcweir             m_doc->appendChild(Reference<css::xml::dom::XNode>(
104cdf0e10cSrcweir                                    rootNode, UNO_QUERY_THROW));
105cdf0e10cSrcweir             save();
106cdf0e10cSrcweir         }
107cdf0e10cSrcweir         else
108cdf0e10cSrcweir             throw css::uno::RuntimeException(
109cdf0e10cSrcweir                 OUSTR("Extension manager could not access database file:" )
110cdf0e10cSrcweir                 + m_urlDb, 0);
111cdf0e10cSrcweir 
112cdf0e10cSrcweir         if (!m_doc.is())
113cdf0e10cSrcweir             throw css::uno::RuntimeException(
114cdf0e10cSrcweir                 OUSTR("Extension manager could not get root node of data base file: ")
115cdf0e10cSrcweir                       + m_urlDb, 0);
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir 
118cdf0e10cSrcweir     return m_doc;
119cdf0e10cSrcweir }
120cdf0e10cSrcweir 
getXPathAPI()121cdf0e10cSrcweir Reference<css::xml::xpath::XXPathAPI> BackendDb::getXPathAPI()
122cdf0e10cSrcweir {
123cdf0e10cSrcweir     if (!m_xpathApi.is())
124cdf0e10cSrcweir     {
125cdf0e10cSrcweir         m_xpathApi = Reference< css::xml::xpath::XXPathAPI >(
126cdf0e10cSrcweir             m_xContext->getServiceManager()->createInstanceWithContext(
127cdf0e10cSrcweir                 OUSTR("com.sun.star.xml.xpath.XPathAPI"),
128cdf0e10cSrcweir                 m_xContext), css::uno::UNO_QUERY);
129cdf0e10cSrcweir 
130cdf0e10cSrcweir         if (!m_xpathApi.is())
131cdf0e10cSrcweir             throw css::uno::RuntimeException(
132cdf0e10cSrcweir                 OUSTR(" Could not create service com.sun.star.xml.xpath.XPathAPI"), 0);
133cdf0e10cSrcweir 
134cdf0e10cSrcweir         m_xpathApi->registerNS(
135cdf0e10cSrcweir             getNSPrefix(), getDbNSName());
136cdf0e10cSrcweir     }
137cdf0e10cSrcweir 
138cdf0e10cSrcweir     return m_xpathApi;
139cdf0e10cSrcweir }
140cdf0e10cSrcweir 
removeElement(::rtl::OUString const & sXPathExpression)141cdf0e10cSrcweir void BackendDb::removeElement(::rtl::OUString const & sXPathExpression)
142cdf0e10cSrcweir {
143cdf0e10cSrcweir     try
144cdf0e10cSrcweir     {
145cdf0e10cSrcweir         const Reference<css::xml::dom::XDocument> doc = getDocument();
146cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
147cdf0e10cSrcweir         const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
148cdf0e10cSrcweir         //find the extension element that is to be removed
149cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> aNode =
150cdf0e10cSrcweir             xpathApi->selectSingleNode(root, sXPathExpression);
151cdf0e10cSrcweir 
152cdf0e10cSrcweir         if (aNode.is())
153cdf0e10cSrcweir         {
154cdf0e10cSrcweir             root->removeChild(aNode);
155cdf0e10cSrcweir             save();
156cdf0e10cSrcweir         }
157cdf0e10cSrcweir 
158cdf0e10cSrcweir #if    OSL_DEBUG_LEVEL > 0
159cdf0e10cSrcweir         //There must not be any other entry with the same url
160cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> nextNode =
161cdf0e10cSrcweir             xpathApi->selectSingleNode(root, sXPathExpression);
162cdf0e10cSrcweir         OSL_ASSERT(! nextNode.is());
163cdf0e10cSrcweir #endif
164cdf0e10cSrcweir     }
165cdf0e10cSrcweir     catch(css::uno::Exception &)
166cdf0e10cSrcweir     {
167cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
168cdf0e10cSrcweir         throw css::deployment::DeploymentException(
169cdf0e10cSrcweir             OUSTR("Extension Manager: failed to write data entry in backend db: ") +
170cdf0e10cSrcweir             m_urlDb, 0, exc);
171cdf0e10cSrcweir     }
172cdf0e10cSrcweir }
173cdf0e10cSrcweir 
removeEntry(::rtl::OUString const & url)174cdf0e10cSrcweir void BackendDb::removeEntry(::rtl::OUString const & url)
175cdf0e10cSrcweir {
176cdf0e10cSrcweir     const OUString sKeyElement = getKeyElementName();
177cdf0e10cSrcweir     const OUString sPrefix = getNSPrefix();
178cdf0e10cSrcweir     ::rtl::OUStringBuffer sExpression(500);
179cdf0e10cSrcweir     sExpression.append(sPrefix);
180cdf0e10cSrcweir     sExpression.appendAscii(":");
181cdf0e10cSrcweir     sExpression.append(sKeyElement);
182cdf0e10cSrcweir     sExpression.append(OUSTR("[@url = \""));
183cdf0e10cSrcweir     sExpression.append(url);
184cdf0e10cSrcweir     sExpression.appendAscii("\"]");
185cdf0e10cSrcweir 
186cdf0e10cSrcweir     removeElement(sExpression.makeStringAndClear());
187cdf0e10cSrcweir }
188cdf0e10cSrcweir 
revokeEntry(::rtl::OUString const & url)189cdf0e10cSrcweir void BackendDb::revokeEntry(::rtl::OUString const & url)
190cdf0e10cSrcweir {
191cdf0e10cSrcweir     try
192cdf0e10cSrcweir     {
193cdf0e10cSrcweir         Reference<css::xml::dom::XElement> entry = Reference<css::xml::dom::XElement>(getKeyElement(url), UNO_QUERY);
194cdf0e10cSrcweir         if (entry.is())
195cdf0e10cSrcweir         {
196cdf0e10cSrcweir             entry->setAttribute(OUSTR("revoked"), OUSTR("true"));
197cdf0e10cSrcweir             save();
198cdf0e10cSrcweir         }
199cdf0e10cSrcweir     }
200cdf0e10cSrcweir     catch(css::uno::Exception &)
201cdf0e10cSrcweir     {
202cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
203cdf0e10cSrcweir         throw css::deployment::DeploymentException(
204cdf0e10cSrcweir             OUSTR("Extension Manager: failed to revoke data entry in backend db: ") +
205cdf0e10cSrcweir             m_urlDb, 0, exc);
206cdf0e10cSrcweir     }
207cdf0e10cSrcweir }
208cdf0e10cSrcweir 
activateEntry(::rtl::OUString const & url)209cdf0e10cSrcweir bool BackendDb::activateEntry(::rtl::OUString const & url)
210cdf0e10cSrcweir {
211cdf0e10cSrcweir     try
212cdf0e10cSrcweir     {
213cdf0e10cSrcweir         bool ret = false;
214cdf0e10cSrcweir         Reference<css::xml::dom::XElement> entry = Reference<css::xml::dom::XElement>(getKeyElement(url), UNO_QUERY);
215cdf0e10cSrcweir         if (entry.is())
216cdf0e10cSrcweir         {
217cdf0e10cSrcweir             //no attribute "active" means it is active, that is, registered.
218cdf0e10cSrcweir             entry->removeAttribute(OUSTR("revoked"));
219cdf0e10cSrcweir             save();
220cdf0e10cSrcweir             ret = true;
221cdf0e10cSrcweir         }
222cdf0e10cSrcweir         return ret;
223cdf0e10cSrcweir     }
224cdf0e10cSrcweir     catch(css::uno::Exception &)
225cdf0e10cSrcweir     {
226cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
227cdf0e10cSrcweir         throw css::deployment::DeploymentException(
228cdf0e10cSrcweir             OUSTR("Extension Manager: failed to revoke data entry in backend db: ") +
229cdf0e10cSrcweir             m_urlDb, 0, exc);
230cdf0e10cSrcweir     }
231cdf0e10cSrcweir }
232cdf0e10cSrcweir 
hasActiveEntry(::rtl::OUString const & url)233cdf0e10cSrcweir bool BackendDb::hasActiveEntry(::rtl::OUString const & url)
234cdf0e10cSrcweir {
235cdf0e10cSrcweir     try
236cdf0e10cSrcweir     {
237cdf0e10cSrcweir         bool ret = false;
238cdf0e10cSrcweir         Reference<css::xml::dom::XElement> entry = Reference<css::xml::dom::XElement>(getKeyElement(url), UNO_QUERY);
239cdf0e10cSrcweir         if (entry.is())
240cdf0e10cSrcweir         {
241cdf0e10cSrcweir             OUString sActive = entry->getAttribute(OUSTR("revoked"));
242cdf0e10cSrcweir             if (!sActive.equals(OUSTR("true")))
243cdf0e10cSrcweir                 ret = true;
244cdf0e10cSrcweir         }
245cdf0e10cSrcweir         return ret;
246cdf0e10cSrcweir 
247cdf0e10cSrcweir     }
248cdf0e10cSrcweir     catch(css::uno::Exception &)
249cdf0e10cSrcweir     {
250cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
251cdf0e10cSrcweir         throw css::deployment::DeploymentException(
252cdf0e10cSrcweir             OUSTR("Extension Manager: failed to determine an active entry in backend db: ") +
253cdf0e10cSrcweir             m_urlDb, 0, exc);
254cdf0e10cSrcweir     }
255cdf0e10cSrcweir }
256cdf0e10cSrcweir 
getKeyElement(::rtl::OUString const & url)257cdf0e10cSrcweir Reference<css::xml::dom::XNode> BackendDb::getKeyElement(
258cdf0e10cSrcweir     ::rtl::OUString const & url)
259cdf0e10cSrcweir {
260cdf0e10cSrcweir     try
261cdf0e10cSrcweir     {
262cdf0e10cSrcweir         const OUString sPrefix = getNSPrefix();
263cdf0e10cSrcweir         const OUString sKeyElement = getKeyElementName();
264cdf0e10cSrcweir         ::rtl::OUStringBuffer sExpression(500);
265cdf0e10cSrcweir         sExpression.append(sPrefix);
266cdf0e10cSrcweir         sExpression.appendAscii(":");
267cdf0e10cSrcweir         sExpression.append(sKeyElement);
268cdf0e10cSrcweir         sExpression.append(OUSTR("[@url = \""));
269cdf0e10cSrcweir         sExpression.append(url);
270cdf0e10cSrcweir         sExpression.appendAscii("\"]");
271cdf0e10cSrcweir 
272cdf0e10cSrcweir         const Reference<css::xml::dom::XDocument> doc = getDocument();
273cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
274cdf0e10cSrcweir         const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
275cdf0e10cSrcweir         return xpathApi->selectSingleNode(root, sExpression.makeStringAndClear());
276cdf0e10cSrcweir     }
277cdf0e10cSrcweir     catch(css::uno::Exception &)
278cdf0e10cSrcweir     {
279cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
280cdf0e10cSrcweir         throw css::deployment::DeploymentException(
281cdf0e10cSrcweir             OUSTR("Extension Manager: failed to read key element in backend db: ") +
282cdf0e10cSrcweir             m_urlDb, 0, exc);
283cdf0e10cSrcweir     }
284cdf0e10cSrcweir }
285cdf0e10cSrcweir 
286cdf0e10cSrcweir //Only writes the data if there is at least one entry
writeVectorOfPair(::std::vector<::std::pair<::rtl::OUString,::rtl::OUString>> const & vecPairs,OUString const & sVectorTagName,OUString const & sPairTagName,OUString const & sFirstTagName,OUString const & sSecondTagName,css::uno::Reference<css::xml::dom::XNode> const & xParent)287cdf0e10cSrcweir void BackendDb::writeVectorOfPair(
288cdf0e10cSrcweir     ::std::vector< ::std::pair< ::rtl::OUString, ::rtl::OUString > > const & vecPairs,
289cdf0e10cSrcweir     OUString const & sVectorTagName,
290cdf0e10cSrcweir     OUString const & sPairTagName,
291cdf0e10cSrcweir     OUString const & sFirstTagName,
292cdf0e10cSrcweir     OUString const & sSecondTagName,
293cdf0e10cSrcweir     css::uno::Reference<css::xml::dom::XNode> const & xParent)
294cdf0e10cSrcweir {
295cdf0e10cSrcweir     try{
296cdf0e10cSrcweir         if (vecPairs.size() == 0)
297cdf0e10cSrcweir             return;
298cdf0e10cSrcweir         const OUString sNameSpace = getDbNSName();
299cdf0e10cSrcweir         OSL_ASSERT(sNameSpace.getLength());
300cdf0e10cSrcweir         const OUString sPrefix(getNSPrefix() + OUSTR(":"));
301cdf0e10cSrcweir         const Reference<css::xml::dom::XDocument> doc = getDocument();
302cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
303cdf0e10cSrcweir 
304cdf0e10cSrcweir         const Reference<css::xml::dom::XElement> vectorNode(
305cdf0e10cSrcweir             doc->createElementNS(sNameSpace, sPrefix + sVectorTagName));
306cdf0e10cSrcweir 
307cdf0e10cSrcweir         xParent->appendChild(
308cdf0e10cSrcweir             Reference<css::xml::dom::XNode>(
309cdf0e10cSrcweir                 vectorNode, css::uno::UNO_QUERY_THROW));
310cdf0e10cSrcweir         typedef ::std::vector< ::std::pair< OUString, OUString > >::const_iterator CIT;
311cdf0e10cSrcweir         for (CIT i = vecPairs.begin(); i != vecPairs.end(); i++)
312cdf0e10cSrcweir         {
313cdf0e10cSrcweir             const Reference<css::xml::dom::XElement> pairNode(
314cdf0e10cSrcweir                 doc->createElementNS(sNameSpace, sPrefix + sPairTagName));
315cdf0e10cSrcweir 
316cdf0e10cSrcweir             vectorNode->appendChild(
317cdf0e10cSrcweir                 Reference<css::xml::dom::XNode>(
318cdf0e10cSrcweir                     pairNode, css::uno::UNO_QUERY_THROW));
319cdf0e10cSrcweir 
320cdf0e10cSrcweir             const Reference<css::xml::dom::XElement> firstNode(
321cdf0e10cSrcweir                 doc->createElementNS(sNameSpace, sPrefix + sFirstTagName));
322cdf0e10cSrcweir 
323cdf0e10cSrcweir             pairNode->appendChild(
324cdf0e10cSrcweir                 Reference<css::xml::dom::XNode>(
325cdf0e10cSrcweir                     firstNode, css::uno::UNO_QUERY_THROW));
326cdf0e10cSrcweir 
327cdf0e10cSrcweir             const Reference<css::xml::dom::XText> firstTextNode(
328cdf0e10cSrcweir                 doc->createTextNode( i->first));
329cdf0e10cSrcweir 
330cdf0e10cSrcweir             firstNode->appendChild(
331cdf0e10cSrcweir                 Reference<css::xml::dom::XNode>(
332cdf0e10cSrcweir                     firstTextNode, css::uno::UNO_QUERY_THROW));
333cdf0e10cSrcweir 
334cdf0e10cSrcweir             const Reference<css::xml::dom::XElement> secondNode(
335cdf0e10cSrcweir                 doc->createElementNS(sNameSpace, sPrefix + sSecondTagName));
336cdf0e10cSrcweir 
337cdf0e10cSrcweir             pairNode->appendChild(
338cdf0e10cSrcweir                 Reference<css::xml::dom::XNode>(
339cdf0e10cSrcweir                     secondNode, css::uno::UNO_QUERY_THROW));
340cdf0e10cSrcweir 
341cdf0e10cSrcweir             const Reference<css::xml::dom::XText> secondTextNode(
342cdf0e10cSrcweir                 doc->createTextNode( i->second));
343cdf0e10cSrcweir 
344cdf0e10cSrcweir             secondNode->appendChild(
345cdf0e10cSrcweir                 Reference<css::xml::dom::XNode>(
346cdf0e10cSrcweir                     secondTextNode, css::uno::UNO_QUERY_THROW));
347cdf0e10cSrcweir         }
348cdf0e10cSrcweir     }
349cdf0e10cSrcweir     catch(css::uno::Exception &)
350cdf0e10cSrcweir     {
351cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
352cdf0e10cSrcweir         throw css::deployment::DeploymentException(
353cdf0e10cSrcweir             OUSTR("Extension Manager: failed to write data entry in backend db: ") +
354cdf0e10cSrcweir             m_urlDb, 0, exc);
355cdf0e10cSrcweir     }
356cdf0e10cSrcweir }
357cdf0e10cSrcweir 
358cdf0e10cSrcweir ::std::vector< ::std::pair< OUString, OUString > >
readVectorOfPair(Reference<css::xml::dom::XNode> const & parent,OUString const & sListTagName,OUString const & sPairTagName,OUString const & sFirstTagName,OUString const & sSecondTagName)359cdf0e10cSrcweir BackendDb::readVectorOfPair(
360cdf0e10cSrcweir     Reference<css::xml::dom::XNode> const & parent,
361cdf0e10cSrcweir     OUString const & sListTagName,
362cdf0e10cSrcweir     OUString const & sPairTagName,
363cdf0e10cSrcweir     OUString const & sFirstTagName,
364cdf0e10cSrcweir     OUString const & sSecondTagName)
365cdf0e10cSrcweir {
366cdf0e10cSrcweir     try
367cdf0e10cSrcweir     {
368cdf0e10cSrcweir         OSL_ASSERT(parent.is());
369cdf0e10cSrcweir         const OUString sPrefix(getNSPrefix() + OUSTR(":"));
370cdf0e10cSrcweir         const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
371cdf0e10cSrcweir         const OUString sExprPairs(
372cdf0e10cSrcweir             sPrefix + sListTagName + OUSTR("/") + sPrefix + sPairTagName);
373cdf0e10cSrcweir         const Reference<css::xml::dom::XNodeList> listPairs =
374cdf0e10cSrcweir             xpathApi->selectNodeList(parent, sExprPairs);
375cdf0e10cSrcweir 
376cdf0e10cSrcweir         ::std::vector< ::std::pair< OUString, OUString > > retVector;
377cdf0e10cSrcweir         sal_Int32 length = listPairs->getLength();
378cdf0e10cSrcweir         for (sal_Int32 i = 0; i < length; i++)
379cdf0e10cSrcweir         {
380cdf0e10cSrcweir             const Reference<css::xml::dom::XNode> aPair = listPairs->item(i);
381cdf0e10cSrcweir             const OUString sExprFirst(sPrefix + sFirstTagName + OUSTR("/text()"));
382cdf0e10cSrcweir             const Reference<css::xml::dom::XNode> first =
383cdf0e10cSrcweir                 xpathApi->selectSingleNode(aPair, sExprFirst);
384cdf0e10cSrcweir 
385cdf0e10cSrcweir             const OUString sExprSecond(sPrefix + sSecondTagName + OUSTR("/text()"));
386cdf0e10cSrcweir             const Reference<css::xml::dom::XNode> second =
387cdf0e10cSrcweir                 xpathApi->selectSingleNode(aPair, sExprSecond);
388cdf0e10cSrcweir             OSL_ASSERT(first.is() && second.is());
389cdf0e10cSrcweir 
390cdf0e10cSrcweir             retVector.push_back(::std::make_pair(
391cdf0e10cSrcweir                                     first->getNodeValue(), second->getNodeValue()));
392cdf0e10cSrcweir         }
393cdf0e10cSrcweir         return retVector;
394cdf0e10cSrcweir     }
395cdf0e10cSrcweir     catch(css::uno::Exception &)
396cdf0e10cSrcweir     {
397cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
398cdf0e10cSrcweir         throw css::deployment::DeploymentException(
399cdf0e10cSrcweir             OUSTR("Extension Manager: failed to read data entry in backend db: ") +
400cdf0e10cSrcweir             m_urlDb, 0, exc);
401cdf0e10cSrcweir     }
402cdf0e10cSrcweir }
403cdf0e10cSrcweir 
404cdf0e10cSrcweir //Only writes the data if there is at least one entry
writeSimpleList(::std::list<::rtl::OUString> const & list,OUString const & sListTagName,OUString const & sMemberTagName,Reference<css::xml::dom::XNode> const & xParent)405cdf0e10cSrcweir void BackendDb::writeSimpleList(
406cdf0e10cSrcweir     ::std::list< ::rtl::OUString> const & list,
407cdf0e10cSrcweir     OUString const & sListTagName,
408cdf0e10cSrcweir     OUString const & sMemberTagName,
409cdf0e10cSrcweir     Reference<css::xml::dom::XNode> const & xParent)
410cdf0e10cSrcweir {
411cdf0e10cSrcweir     try
412cdf0e10cSrcweir     {
413cdf0e10cSrcweir         if (list.size() == 0)
414cdf0e10cSrcweir             return;
415cdf0e10cSrcweir         const OUString sNameSpace = getDbNSName();
416cdf0e10cSrcweir         const OUString sPrefix(getNSPrefix() + OUSTR(":"));
417cdf0e10cSrcweir         const Reference<css::xml::dom::XDocument> doc = getDocument();
418cdf0e10cSrcweir 
419cdf0e10cSrcweir         const Reference<css::xml::dom::XElement> listNode(
420cdf0e10cSrcweir             doc->createElementNS(sNameSpace, sPrefix + sListTagName));
421cdf0e10cSrcweir 
422cdf0e10cSrcweir         xParent->appendChild(
423cdf0e10cSrcweir             Reference<css::xml::dom::XNode>(
424cdf0e10cSrcweir                 listNode, css::uno::UNO_QUERY_THROW));
425cdf0e10cSrcweir 
426cdf0e10cSrcweir         typedef ::std::list<OUString>::const_iterator ITC_ITEMS;
427cdf0e10cSrcweir         for (ITC_ITEMS i = list.begin(); i != list.end(); i++)
428cdf0e10cSrcweir         {
429cdf0e10cSrcweir             const Reference<css::xml::dom::XNode> memberNode(
430cdf0e10cSrcweir                 doc->createElementNS(sNameSpace, sPrefix + sMemberTagName), css::uno::UNO_QUERY_THROW);
431cdf0e10cSrcweir 
432cdf0e10cSrcweir             listNode->appendChild(memberNode);
433cdf0e10cSrcweir 
434cdf0e10cSrcweir             const Reference<css::xml::dom::XNode> textNode(
435cdf0e10cSrcweir                 doc->createTextNode( *i), css::uno::UNO_QUERY_THROW);
436cdf0e10cSrcweir 
437cdf0e10cSrcweir             memberNode->appendChild(textNode);
438cdf0e10cSrcweir         }
439cdf0e10cSrcweir     }
440cdf0e10cSrcweir     catch(css::uno::Exception &)
441cdf0e10cSrcweir     {
442cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
443cdf0e10cSrcweir         throw css::deployment::DeploymentException(
444cdf0e10cSrcweir             OUSTR("Extension Manager: failed to write data entry in backend db: ") +
445cdf0e10cSrcweir             m_urlDb, 0, exc);
446cdf0e10cSrcweir     }
447cdf0e10cSrcweir }
448cdf0e10cSrcweir 
449cdf0e10cSrcweir //Writes only the element if is has a value.
450cdf0e10cSrcweir //The prefix is automatically added to the element name
writeSimpleElement(OUString const & sElementName,OUString const & value,Reference<css::xml::dom::XNode> const & xParent)451cdf0e10cSrcweir void BackendDb::writeSimpleElement(
452cdf0e10cSrcweir     OUString const & sElementName, OUString const & value,
453cdf0e10cSrcweir     Reference<css::xml::dom::XNode> const & xParent)
454cdf0e10cSrcweir {
455cdf0e10cSrcweir     try
456cdf0e10cSrcweir     {
457cdf0e10cSrcweir         if (value.getLength() == 0)
458cdf0e10cSrcweir             return;
459cdf0e10cSrcweir         const OUString sPrefix = getNSPrefix();
460cdf0e10cSrcweir         const Reference<css::xml::dom::XDocument> doc = getDocument();
461cdf0e10cSrcweir         const OUString sNameSpace = getDbNSName();
462cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> dataNode(
463cdf0e10cSrcweir             doc->createElementNS(sNameSpace, sPrefix + OUSTR(":") + sElementName),
464cdf0e10cSrcweir             UNO_QUERY_THROW);
465cdf0e10cSrcweir         xParent->appendChild(dataNode);
466cdf0e10cSrcweir 
467cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> dataValue(
468cdf0e10cSrcweir             doc->createTextNode(value), UNO_QUERY_THROW);
469cdf0e10cSrcweir         dataNode->appendChild(dataValue);
470cdf0e10cSrcweir     }
471cdf0e10cSrcweir     catch(css::uno::Exception &)
472cdf0e10cSrcweir     {
473cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
474cdf0e10cSrcweir         throw css::deployment::DeploymentException(
475cdf0e10cSrcweir             OUSTR("Extension Manager: failed to write data entry(writeSimpleElement) in backend db: ") +
476cdf0e10cSrcweir             m_urlDb, 0, exc);
477cdf0e10cSrcweir     }
478cdf0e10cSrcweir 
479cdf0e10cSrcweir }
480cdf0e10cSrcweir 
481cdf0e10cSrcweir /** The key elements have an url attribute and are always children of the root
482cdf0e10cSrcweir     element.
483cdf0e10cSrcweir */
writeKeyElement(::rtl::OUString const & url)484cdf0e10cSrcweir Reference<css::xml::dom::XNode> BackendDb::writeKeyElement(
485cdf0e10cSrcweir     ::rtl::OUString const & url)
486cdf0e10cSrcweir {
487cdf0e10cSrcweir     try
488cdf0e10cSrcweir     {
489cdf0e10cSrcweir         const OUString sNameSpace = getDbNSName();
490cdf0e10cSrcweir         const OUString sPrefix = getNSPrefix();
491cdf0e10cSrcweir         const OUString sElementName = getKeyElementName();
492cdf0e10cSrcweir         const Reference<css::xml::dom::XDocument> doc = getDocument();
493cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> root = doc->getFirstChild();
494cdf0e10cSrcweir 
495cdf0e10cSrcweir         //Check if there are an entry with the same url. This can be the case if the
496cdf0e10cSrcweir         //the status of an XPackage is ambiguous. In this case a call to activateExtension
497cdf0e10cSrcweir         //(dp_extensionmanager.cxx), will register the package again. See also
498cdf0e10cSrcweir         //Package::processPackage_impl in dp_backend.cxx.
499cdf0e10cSrcweir         //A package can become
500cdf0e10cSrcweir         //invalid after its successful registration, for example if a second extension with
501cdf0e10cSrcweir         //the same service is installed.
502cdf0e10cSrcweir         const OUString sExpression(
503cdf0e10cSrcweir             sPrefix + OUSTR(":") + sElementName + OUSTR("[@url = \"") + url + OUSTR("\"]"));
504cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> existingNode =
505cdf0e10cSrcweir             getXPathAPI()->selectSingleNode(root, sExpression);
506cdf0e10cSrcweir         if (existingNode.is())
507cdf0e10cSrcweir         {
508cdf0e10cSrcweir             OSL_ASSERT(0);
509cdf0e10cSrcweir             //replace the existing entry.
510cdf0e10cSrcweir             removeEntry(url);
511cdf0e10cSrcweir         }
512cdf0e10cSrcweir 
513cdf0e10cSrcweir         const Reference<css::xml::dom::XElement> keyElement(
514cdf0e10cSrcweir             doc->createElementNS(sNameSpace, sPrefix +  OUSTR(":") + sElementName));
515cdf0e10cSrcweir 
516cdf0e10cSrcweir         keyElement->setAttribute(OUSTR("url"), url);
517cdf0e10cSrcweir 
518cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> keyNode(
519cdf0e10cSrcweir             keyElement, UNO_QUERY_THROW);
520cdf0e10cSrcweir         root->appendChild(keyNode);
521cdf0e10cSrcweir         return keyNode;
522cdf0e10cSrcweir     }
523cdf0e10cSrcweir     catch(css::uno::Exception &)
524cdf0e10cSrcweir     {
525cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
526cdf0e10cSrcweir         throw css::deployment::DeploymentException(
527cdf0e10cSrcweir             OUSTR("Extension Manager: failed to write key element in backend db: ") +
528cdf0e10cSrcweir             m_urlDb, 0, exc);
529cdf0e10cSrcweir     }
530cdf0e10cSrcweir }
531cdf0e10cSrcweir 
readSimpleElement(OUString const & sElementName,Reference<css::xml::dom::XNode> const & xParent)532cdf0e10cSrcweir OUString BackendDb::readSimpleElement(
533cdf0e10cSrcweir     OUString const & sElementName, Reference<css::xml::dom::XNode> const & xParent)
534cdf0e10cSrcweir {
535cdf0e10cSrcweir     try
536cdf0e10cSrcweir     {
537cdf0e10cSrcweir         const OUString sPrefix = getNSPrefix();
538cdf0e10cSrcweir         const OUString sExpr(sPrefix + OUSTR(":") + sElementName + OUSTR("/text()"));
539cdf0e10cSrcweir         const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
540cdf0e10cSrcweir         const Reference<css::xml::dom::XNode> val =
541cdf0e10cSrcweir             xpathApi->selectSingleNode(xParent, sExpr);
542cdf0e10cSrcweir         if (val.is())
543cdf0e10cSrcweir             return val->getNodeValue();
544cdf0e10cSrcweir         return OUString();
545cdf0e10cSrcweir     }
546cdf0e10cSrcweir     catch(css::uno::Exception &)
547cdf0e10cSrcweir     {
548cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
549cdf0e10cSrcweir         throw css::deployment::DeploymentException(
550cdf0e10cSrcweir             OUSTR("Extension Manager: failed to read data (readSimpleElement) in backend db: ") +
551cdf0e10cSrcweir             m_urlDb, 0, exc);
552cdf0e10cSrcweir     }
553cdf0e10cSrcweir }
554cdf0e10cSrcweir 
555cdf0e10cSrcweir 
readList(Reference<css::xml::dom::XNode> const & parent,OUString const & sListTagName,OUString const & sMemberTagName)556cdf0e10cSrcweir ::std::list< OUString> BackendDb::readList(
557cdf0e10cSrcweir     Reference<css::xml::dom::XNode> const & parent,
558cdf0e10cSrcweir     OUString const & sListTagName,
559cdf0e10cSrcweir     OUString const & sMemberTagName)
560cdf0e10cSrcweir {
561cdf0e10cSrcweir     try
562cdf0e10cSrcweir     {
563cdf0e10cSrcweir         OSL_ASSERT(parent.is());
564cdf0e10cSrcweir         const OUString sPrefix(getNSPrefix() + OUSTR(":"));
565cdf0e10cSrcweir         const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
566cdf0e10cSrcweir         const OUString sExprList(
567cdf0e10cSrcweir             sPrefix + sListTagName + OUSTR("/") + sPrefix + sMemberTagName + OUSTR("/text()"));
568cdf0e10cSrcweir         const Reference<css::xml::dom::XNodeList> list =
569cdf0e10cSrcweir             xpathApi->selectNodeList(parent, sExprList);
570cdf0e10cSrcweir 
571cdf0e10cSrcweir         ::std::list<OUString > retList;
572cdf0e10cSrcweir         sal_Int32 length = list->getLength();
573cdf0e10cSrcweir         for (sal_Int32 i = 0; i < length; i++)
574cdf0e10cSrcweir         {
575cdf0e10cSrcweir             const Reference<css::xml::dom::XNode> member = list->item(i);
576cdf0e10cSrcweir             retList.push_back(member->getNodeValue());
577cdf0e10cSrcweir         }
578cdf0e10cSrcweir         return retList;
579cdf0e10cSrcweir     }
580cdf0e10cSrcweir     catch(css::uno::Exception &)
581cdf0e10cSrcweir     {
582cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
583cdf0e10cSrcweir         throw css::deployment::DeploymentException(
584cdf0e10cSrcweir             OUSTR("Extension Manager: failed to read data entry in backend db: ") +
585cdf0e10cSrcweir             m_urlDb, 0, exc);
586cdf0e10cSrcweir     }
587cdf0e10cSrcweir }
588cdf0e10cSrcweir 
getOneChildFromAllEntries(OUString const & name)589cdf0e10cSrcweir ::std::list<OUString> BackendDb::getOneChildFromAllEntries(
590cdf0e10cSrcweir     OUString const & name)
591cdf0e10cSrcweir {
592cdf0e10cSrcweir     try
593cdf0e10cSrcweir     {
594cdf0e10cSrcweir         ::std::list<OUString> listRet;
595cdf0e10cSrcweir         Reference<css::xml::dom::XDocument> doc = getDocument();
596cdf0e10cSrcweir         Reference<css::xml::dom::XNode> root = doc->getFirstChild();
597cdf0e10cSrcweir 
598cdf0e10cSrcweir         Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
599cdf0e10cSrcweir         const OUString sPrefix = getNSPrefix();
600cdf0e10cSrcweir         const OUString sKeyElement = getKeyElementName();
601cdf0e10cSrcweir         ::rtl::OUStringBuffer buf(512);
602cdf0e10cSrcweir         buf.append(sPrefix);
603cdf0e10cSrcweir         buf.appendAscii(":");
604cdf0e10cSrcweir         buf.append(sKeyElement);
605cdf0e10cSrcweir         buf.appendAscii("/");
606cdf0e10cSrcweir         buf.append(sPrefix);
607cdf0e10cSrcweir         buf.appendAscii(":");
608cdf0e10cSrcweir         buf.append(name);
609cdf0e10cSrcweir         buf.append(OUSTR("/text()"));
610cdf0e10cSrcweir 
611cdf0e10cSrcweir         Reference<css::xml::dom::XNodeList> nodes =
612cdf0e10cSrcweir             xpathApi->selectNodeList(root, buf.makeStringAndClear());
613cdf0e10cSrcweir         if (nodes.is())
614cdf0e10cSrcweir         {
615cdf0e10cSrcweir             sal_Int32 length = nodes->getLength();
616cdf0e10cSrcweir             for (sal_Int32 i = 0; i < length; i++)
617cdf0e10cSrcweir                 listRet.push_back(nodes->item(i)->getNodeValue());
618cdf0e10cSrcweir         }
619cdf0e10cSrcweir         return listRet;
620cdf0e10cSrcweir     }
621cdf0e10cSrcweir     catch (css::deployment::DeploymentException& )
622cdf0e10cSrcweir     {
623cdf0e10cSrcweir         throw;
624cdf0e10cSrcweir     }
625cdf0e10cSrcweir     catch(css::uno::Exception &)
626cdf0e10cSrcweir     {
627cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
628cdf0e10cSrcweir         throw css::deployment::DeploymentException(
629cdf0e10cSrcweir             OUSTR("Extension Manager: failed to read data entry in backend db: ") +
630cdf0e10cSrcweir             m_urlDb, 0, exc);
631cdf0e10cSrcweir     }
632cdf0e10cSrcweir }
633cdf0e10cSrcweir 
634cdf0e10cSrcweir 
635cdf0e10cSrcweir 
636cdf0e10cSrcweir //================================================================================
RegisteredDb(Reference<XComponentContext> const & xContext,::rtl::OUString const & url)637cdf0e10cSrcweir RegisteredDb::RegisteredDb(
638cdf0e10cSrcweir     Reference<XComponentContext> const &  xContext,
639cdf0e10cSrcweir     ::rtl::OUString const & url):BackendDb(xContext, url)
640cdf0e10cSrcweir {
641cdf0e10cSrcweir 
642cdf0e10cSrcweir }
643cdf0e10cSrcweir 
addEntry(::rtl::OUString const & url)644cdf0e10cSrcweir void RegisteredDb::addEntry(::rtl::OUString const & url)
645cdf0e10cSrcweir {
646cdf0e10cSrcweir     try{
647cdf0e10cSrcweir         if (!activateEntry(url))
648cdf0e10cSrcweir         {
649cdf0e10cSrcweir             const OUString sNameSpace = getDbNSName();
650cdf0e10cSrcweir             const OUString sPrefix = getNSPrefix();
651cdf0e10cSrcweir             const OUString sEntry = getKeyElementName();
652cdf0e10cSrcweir 
653cdf0e10cSrcweir             Reference<css::xml::dom::XDocument> doc = getDocument();
654cdf0e10cSrcweir             Reference<css::xml::dom::XNode> root = doc->getFirstChild();
655cdf0e10cSrcweir 
656cdf0e10cSrcweir #if    OSL_DEBUG_LEVEL > 0
657cdf0e10cSrcweir             //There must not be yet an entry with the same url
658cdf0e10cSrcweir             OUString sExpression(
659cdf0e10cSrcweir                 sPrefix + OUSTR(":") + sEntry + OUSTR("[@url = \"") + url + OUSTR("\"]"));
660cdf0e10cSrcweir             Reference<css::xml::dom::XNode> _extensionNode =
661cdf0e10cSrcweir                 getXPathAPI()->selectSingleNode(root, sExpression);
662cdf0e10cSrcweir             OSL_ASSERT(! _extensionNode.is());
663cdf0e10cSrcweir #endif
664cdf0e10cSrcweir             Reference<css::xml::dom::XElement> helpElement(
665cdf0e10cSrcweir                 doc->createElementNS(sNameSpace, sPrefix +  OUSTR(":") + sEntry));
666cdf0e10cSrcweir 
667cdf0e10cSrcweir             helpElement->setAttribute(OUSTR("url"), url);
668cdf0e10cSrcweir 
669cdf0e10cSrcweir             Reference<css::xml::dom::XNode> helpNode(
670cdf0e10cSrcweir                 helpElement, UNO_QUERY_THROW);
671cdf0e10cSrcweir             root->appendChild(helpNode);
672cdf0e10cSrcweir 
673cdf0e10cSrcweir             save();
674cdf0e10cSrcweir         }
675cdf0e10cSrcweir     }
676cdf0e10cSrcweir     catch(css::uno::Exception &)
677cdf0e10cSrcweir     {
678cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
679cdf0e10cSrcweir         throw css::deployment::DeploymentException(
680cdf0e10cSrcweir             OUSTR("Extension Manager: failed to write data entry in backend db: ") +
681cdf0e10cSrcweir             m_urlDb, 0, exc);
682cdf0e10cSrcweir     }
683cdf0e10cSrcweir }
684cdf0e10cSrcweir 
getEntry(::rtl::OUString const & url)685cdf0e10cSrcweir bool RegisteredDb::getEntry(::rtl::OUString const & url)
686cdf0e10cSrcweir {
687cdf0e10cSrcweir     try
688cdf0e10cSrcweir     {
689cdf0e10cSrcweir         const OUString sPrefix = getNSPrefix();
690cdf0e10cSrcweir         const OUString sEntry = getKeyElementName();
691cdf0e10cSrcweir         const OUString sExpression(
692cdf0e10cSrcweir             sPrefix + OUSTR(":") + sEntry + OUSTR("[@url = \"") + url + OUSTR("\"]"));
693cdf0e10cSrcweir         Reference<css::xml::dom::XDocument> doc = getDocument();
694cdf0e10cSrcweir         Reference<css::xml::dom::XNode> root = doc->getFirstChild();
695cdf0e10cSrcweir 
696cdf0e10cSrcweir         Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI();
697cdf0e10cSrcweir         //find the extension element that is to be removed
698cdf0e10cSrcweir         Reference<css::xml::dom::XNode> aNode =
699cdf0e10cSrcweir             xpathApi->selectSingleNode(root, sExpression);
700cdf0e10cSrcweir         if (!aNode.is())
701cdf0e10cSrcweir         {
702cdf0e10cSrcweir             return false;
703cdf0e10cSrcweir         }
704cdf0e10cSrcweir         return true;
705cdf0e10cSrcweir     }
706cdf0e10cSrcweir     catch(css::uno::Exception &)
707cdf0e10cSrcweir     {
708cdf0e10cSrcweir         Any exc( ::cppu::getCaughtException() );
709cdf0e10cSrcweir         throw css::deployment::DeploymentException(
710cdf0e10cSrcweir             OUSTR("Extension Manager: failed to read data entry in backend db: ") +
711cdf0e10cSrcweir             m_urlDb, 0, exc);
712cdf0e10cSrcweir     }
713cdf0e10cSrcweir }
714cdf0e10cSrcweir 
715cdf0e10cSrcweir 
716cdf0e10cSrcweir } // namespace backend
717cdf0e10cSrcweir } // namespace dp_registry
718cdf0e10cSrcweir 
719