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>
31constexpr OUStringLiteral
EXTENSION_REG_NS =
u"http://openoffice.org/extensionmanager/configuration-registry/2010";
39 Reference<XComponentContext>
const &
xContext,
71 Reference<css::xml::dom::XNode> helpNode
79 catch (
const css::deployment::DeploymentException& )
83 catch(
const css::uno::Exception &)
85 Any exc( ::cppu::getCaughtException() );
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 &)
117 Any exc( ::cppu::getCaughtException() );
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(
136 Reference<css::xml::dom::XNodeList> nodes =
137 xpathApi->selectNodeList(root, sExpression);
140 sal_Int32
length = nodes->getLength();
142 listRet.push_back(nodes->item(
i)->getNodeValue());
146 catch (
const css::deployment::DeploymentException& )
150 catch(
const css::uno::Exception &)
152 Any exc( ::cppu::getCaughtException() );
153 throw css::deployment::DeploymentException(
154 "Extension Manager: failed to read data entry in configuration backend db: " +
void writeSimpleElement(std::u16string_view sElementName, OUString const &value, css::uno::Reference< css::xml::dom::XNode > const &xParent)
OUString readSimpleElement(std::u16string_view sElementName, css::uno::Reference< css::xml::dom::XNode > const &xParent)
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.
css::uno::Reference< css::xml::dom::XNode > getKeyElement(std::u16string_view url)
css::uno::Reference< css::xml::dom::XDocument > const & getDocument()
css::uno::Reference< css::xml::xpath::XXPathAPI > const & getXPathAPI()
bool activateEntry(std::u16string_view url)
virtual OUString getKeyElementName() override
virtual OUString getRootElementName() override
std::vector< OUString > getAllDataUrls()
void addEntry(OUString const &url, Data const &data)
::std::optional< Data > getEntry(std::u16string_view url)
ConfigurationBackendDb(css::uno::Reference< css::uno::XComponentContext > const &xContext, OUString const &url)
virtual OUString getNSPrefix() override
virtual OUString getDbNSName() override
constexpr OUStringLiteral EXTENSION_REG_NS
constexpr OUStringLiteral NS_PREFIX
constexpr OUStringLiteral KEY_ELEMENT_NAME
constexpr OUStringLiteral ROOT_ELEMENT_NAME
static uno::Reference< css::uno::XComponentContext > xContext