22 #include <com/sun/star/deployment/DeploymentException.hpp>
23 #include <com/sun/star/uno/XComponentContext.hpp>
24 #include <com/sun/star/xml/xpath/XXPathAPI.hpp>
31 #define EXTENSION_REG_NS "http://openoffice.org/extensionmanager/configuration-registry/2010"
32 #define NS_PREFIX "conf"
33 #define ROOT_ELEMENT_NAME "configuration-backend-db"
34 #define KEY_ELEMENT_NAME "configuration"
40 OUString
const & url):
BackendDb(xContext, url)
71 Reference<css::xml::dom::XNode> helpNode
79 catch (
const css::deployment::DeploymentException& )
83 catch(
const css::uno::Exception &)
86 throw css::deployment::DeploymentException(
87 "Extension Manager: failed to write data entry in configuration backend db: " +
93 ::std::optional<ConfigurationBackendDb::Data>
107 return ::std::optional<Data>();
109 return ::std::optional<Data>(retData);
111 catch (
const css::deployment::DeploymentException& )
115 catch(
const css::uno::Exception &)
118 throw css::deployment::DeploymentException(
119 "Extension Manager: failed to read data entry in configuration backend db: " +
128 std::vector<OUString> listRet;
129 Reference<css::xml::dom::XDocument> doc =
getDocument();
130 Reference<css::xml::dom::XNode> root = doc->getFirstChild();
132 Reference<css::xml::xpath::XXPathAPI> xpathApi =
getXPathAPI();
134 OUString sExpression(
135 sPrefix +
":configuration/" + sPrefix +
":data-url/text()");
136 Reference<css::xml::dom::XNodeList> nodes =
137 xpathApi->selectNodeList(root, sExpression);
140 sal_Int32
length = nodes->getLength();
141 for (sal_Int32
i = 0;
i < length;
i++)
142 listRet.push_back(nodes->item(
i)->getNodeValue());
146 catch (
const css::deployment::DeploymentException& )
150 catch(
const css::uno::Exception &)
153 throw css::deployment::DeploymentException(
154 "Extension Manager: failed to read data entry in configuration backend db: " +
css::uno::Reference< css::xml::dom::XDocument > const & getDocument()
bool activateEntry(std::u16string_view url)
OUString readSimpleElement(std::u16string_view sElementName, css::uno::Reference< css::xml::dom::XNode > const &xParent)
virtual OUString getKeyElementName() override
virtual OUString getNSPrefix() override
css::uno::Reference< css::xml::dom::XNode > writeKeyElement(OUString const &url)
The key elements have a url attribute and are always children of the root element.
Any SAL_CALL getCaughtException()
css::uno::Reference< css::xml::dom::XNode > getKeyElement(std::u16string_view url)
virtual OUString getRootElementName() override
ConfigurationBackendDb(css::uno::Reference< css::uno::XComponentContext > const &xContext, OUString const &url)
void writeSimpleElement(std::u16string_view sElementName, OUString const &value, css::uno::Reference< css::xml::dom::XNode > const &xParent)
virtual OUString getDbNSName() override
#define ROOT_ELEMENT_NAME
static uno::Reference< css::uno::XComponentContext > xContext
std::vector< OUString > getAllDataUrls()
css::uno::Reference< css::xml::xpath::XXPathAPI > const & getXPathAPI()
void addEntry(OUString const &url, Data const &data)
::std::optional< Data > getEntry(std::u16string_view url)