summaryrefslogtreecommitdiff
path: root/desktop/source
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2006-10-04 15:55:59 +0000
committerKurt Zenker <kz@openoffice.org>2006-10-04 15:55:59 +0000
commit4b80ea7e725111261a86699c058fda890e3a65ec (patch)
treeaa79eefbb5ba8bf5694647fe6fdb9d3429e7c332 /desktop/source
parent268c474097e05ecedffd34856f3d41f66932fd35 (diff)
INTEGRATION: CWS sb62 (1.12.12); FILE MERGED
2006/09/27 11:51:38 sb 1.12.12.1: #i69163# Added rudimentary extension version handling.
Diffstat (limited to 'desktop/source')
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx40
1 files changed, 38 insertions, 2 deletions
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 7929cee218..7439a6e9d7 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: dp_package.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: obo $ $Date: 2006-09-17 09:44:06 $
+ * last change: $Author: kz $ $Date: 2006-10-04 16:55:59 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -200,6 +200,7 @@ class BackendImpl : public ImplBaseT
css::ucb::CommandAbortedException,
css::uno::RuntimeException);
+ virtual OUString SAL_CALL getVersion() throw (RuntimeException);
};
friend class PackageImpl;
@@ -728,6 +729,41 @@ bool BackendImpl::PackageImpl::checkDependencies(
&& checkLicense(xCmdEnv, *spDescription);
}
+OUString BackendImpl::PackageImpl::getVersion() throw (RuntimeException)
+{
+ try {
+ ExtensionDescription desc(
+ getMyBackend()->getComponentContext(), m_url_expanded,
+ css::uno::Reference< css::ucb::XCommandEnvironment >());
+ css::uno::Reference< css::xml::xpath::XXPathAPI > xpath(
+ desc.getXPathAPI());
+ xpath->registerNS(
+ rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc")),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "http://openoffice.org/extensions/description/2006")));
+ css::uno::Reference< css::xml::dom::XNode > vers(
+ xpath->selectSingleNode(
+ css::uno::Reference< css::xml::dom::XNode >(
+ desc.getRootElement(), css::uno::UNO_QUERY_THROW),
+ rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "/desc:description/desc:version/@value"))));
+ if (vers.is()) {
+ return vers->getNodeValue();
+ }
+ } catch (NoDescriptionException &) {
+ } catch (css::xml::dom::DOMException & e) {
+ throw RuntimeException(
+ (OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
+ "com.sun.star.xml.dom.DOMException: ")) +
+ e.Message),
+ static_cast< OWeakObject * >(this));
+ }
+ return OUString();
+}
+
//______________________________________________________________________________
void BackendImpl::PackageImpl::processPackage_(
::osl::ResettableMutexGuard & guard,