summaryrefslogtreecommitdiff
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
commitbf67bc97960298c3fbeed13a8de1df317dad7fb9 (patch)
tree996c8846062b984882d3c7a2b0f357641c86d250
parentdf1999fe9b36892236513053973fe3e5a4cdad87 (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.
-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 3abc25e6bfe3..734324edc00b 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,