summaryrefslogtreecommitdiff
path: root/desktop/source/deployment/misc
diff options
context:
space:
mode:
authorsb <sb@openoffice.org>2010-04-06 16:53:43 +0200
committersb <sb@openoffice.org>2010-04-06 16:53:43 +0200
commit854ee977ae497cf9229069bf10e4753133ce178e (patch)
treea795961d771b0c5341438e63d1b55d7e5d4c1f48 /desktop/source/deployment/misc
parent6b9635f6b2d62537052bdc11ec84247d3bc72832 (diff)
sb122: #i110548# extension native libraries linking against basis layer; new extension dependency deployment-repositories
Diffstat (limited to 'desktop/source/deployment/misc')
-rw-r--r--desktop/source/deployment/misc/dp_dependencies.cxx88
-rw-r--r--desktop/source/deployment/misc/dp_misc.src12
2 files changed, 99 insertions, 1 deletions
diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx
index 63badbb0c211..49720c861092 100644
--- a/desktop/source/deployment/misc/dp_dependencies.cxx
+++ b/desktop/source/deployment/misc/dp_dependencies.cxx
@@ -69,6 +69,37 @@ bool satisfiesMinimalVersion(::rtl::OUString const & version) {
return compareWithVersion(version) != ::dp_misc::LESS;
}
+bool contains(::rtl::OUString const & list, ::rtl::OUString const & element) {
+ for (::sal_Int32 i = 0;;) {
+ ::sal_Int32 n = i;
+ i = list.indexOf(',', i);
+ if (i == -1) {
+ i = list.getLength();
+ }
+ if (list.copy(n, i) == element) {
+ return true;
+ }
+ if (i == list.getLength()) {
+ return false;
+ }
+ ++i;
+ }
+}
+
+bool checkDeploymentRepositories(
+ css::uno::Reference< css::xml::dom::XElement > const & dependency,
+ ::rtl::OUString const & repository)
+{
+ css::uno::Reference< css::xml::dom::XAttr > sup(
+ dependency->getAttributeNode(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("supported"))));
+ css::uno::Reference< css::xml::dom::XAttr > notSup(
+ dependency->getAttributeNode(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("not-supported"))));
+ return (!sup.is() || contains(sup->getValue(), repository)) &&
+ !(notSup.is() && contains(notSup->getValue(), repository));
+}
+
}
namespace dp_misc {
@@ -76,7 +107,10 @@ namespace dp_misc {
namespace Dependencies {
css::uno::Sequence< css::uno::Reference< css::xml::dom::XElement > >
-check(::dp_misc::DescriptionInfoset const & infoset) {
+check(
+ ::dp_misc::DescriptionInfoset const & infoset,
+ ::rtl::OUString const & repository)
+{
css::uno::Reference< css::xml::dom::XNodeList > deps(
infoset.getDependencies());
::sal_Int32 n = deps->getLength();
@@ -107,6 +141,12 @@ check(::dp_misc::DescriptionInfoset const & infoset) {
e->getAttribute(
::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value"))))
!= ::dp_misc::GREATER;
+ } else if (e->getNamespaceURI().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(xmlNamespace))
+ && e->getTagName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("deployment-repositories")))
+ {
+ sat = checkDeploymentRepositories(e, repository);
} else if (e->hasAttributeNS(
::rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)),
@@ -145,6 +185,52 @@ check(::dp_misc::DescriptionInfoset const & infoset) {
sValue = dependency->getAttribute( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("value") ) );
sReason = ::rtl::OUString( ::String(::dp_misc::getResId(RID_DEPLYOMENT_DEPENDENCIES_MAX)) );
}
+ else if (dependency->getNamespaceURI().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM(xmlNamespace)) &&
+ dependency->getTagName().equalsAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("deployment-repositories")))
+ {
+ css::uno::Reference< css::xml::dom::XAttr > sup(
+ dependency->getAttributeNode(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("supported"))));
+ css::uno::Reference< css::xml::dom::XAttr > notSup(
+ dependency->getAttributeNode(
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("not-supported"))));
+ sValue = ::String(
+ ::dp_misc::getResId(
+ sup.is()
+ ? (notSup.is()
+ ? RID_DEPLOYMENT_DEPENDENCIES_REPO_BOTH
+ : RID_DEPLOYMENT_DEPENDENCIES_REPO_POS)
+ : (notSup.is()
+ ? RID_DEPLOYMENT_DEPENDENCIES_REPO_NEG
+ : RID_DEPLYOMENT_DEPENDENCIES_UNKNOWN)));
+ ::rtl::OUStringBuffer buf;
+ for (::sal_Int32 i = 0;;) {
+ ::sal_Int32 j = sValue.indexOf('%', i);
+ if (j == -1) {
+ buf.append(sValue.copy(i));
+ break;
+ }
+ if (sup.is() &&
+ sValue.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("POS"), j + 1))
+ {
+ buf.append(sValue.copy(i, j - i));
+ buf.append(sup->getValue());
+ i = j + RTL_CONSTASCII_LENGTH("%POS");
+ } else if (notSup.is() &&
+ sValue.matchAsciiL(
+ RTL_CONSTASCII_STRINGPARAM("NEG"), j + 1))
+ {
+ buf.append(sValue.copy(i, j - i));
+ buf.append(notSup->getValue());
+ i = j + RTL_CONSTASCII_LENGTH("%NEG");
+ } else {
+ i = j + 1;
+ }
+ }
+ return buf.makeStringAndClear();
+ }
else if ( dependency->hasAttributeNS( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( xmlNamespace ) ),
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OpenOffice.org-minimal-version" ))))
{
diff --git a/desktop/source/deployment/misc/dp_misc.src b/desktop/source/deployment/misc/dp_misc.src
index 0d341122af16..6dada0178978 100644
--- a/desktop/source/deployment/misc/dp_misc.src
+++ b/desktop/source/deployment/misc/dp_misc.src
@@ -38,3 +38,15 @@ String RID_DEPLYOMENT_DEPENDENCIES_MIN {
String RID_DEPLYOMENT_DEPENDENCIES_MAX {
Text[en-US] = "Extension doesn't support versions greater than: OpenOffice.org %VERSION";
};
+
+String RID_DEPLOYMENT_DEPENDENCIES_REPO_POS {
+ Text[en-US] = "Extension can only be deployed to repositories \"%POS\"";
+};
+
+String RID_DEPLOYMENT_DEPENDENCIES_REPO_NEG {
+ Text[en-US] = "Extension can not be deployed to repositories \"%NEG\"";
+};
+
+String RID_DEPLOYMENT_DEPENDENCIES_REPO_BOTH {
+ Text[en-US] = "Extension can be deployed to repositories \"%POS\" but not to \"%NEG\"";
+};