summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-12-02 00:46:23 +0100
committerJan Holesovsky <kendy@suse.cz>2011-12-02 00:48:02 +0100
commit36269f66836b17eaa7153cd78aa941468629807c (patch)
tree89a639047f381fb1782a3ec644e9b470739f4ee8 /extensions
parentdddfadf9d59fb32f20b45e6a529db8639f73dac5 (diff)
online update: Revert the UpdateInformationProvider::load() cleanup.
It turns out that the direct UCB access was deliberate to be able to provide the identification / additional information.
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/update/feed/makefile.mk1
-rw-r--r--extensions/source/update/feed/updatefeed.cxx50
2 files changed, 40 insertions, 11 deletions
diff --git a/extensions/source/update/feed/makefile.mk b/extensions/source/update/feed/makefile.mk
index 496842d71524..6361f20bdd73 100644
--- a/extensions/source/update/feed/makefile.mk
+++ b/extensions/source/update/feed/makefile.mk
@@ -50,7 +50,6 @@ SHL1OBJS=$(SLOFILES)
SHL1IMPLIB=i$(SHL1TARGET)
SHL1STDLIBS= \
- $(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB)
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index f5caafc4902c..42a73015d116 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -27,12 +27,10 @@
************************************************************************/
-#include <comphelper/mediadescriptor.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase4.hxx>
#include <cppuhelper/implementationentry.hxx>
#include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
@@ -474,17 +472,49 @@ UpdateInformationProvider::storeCommandInfo(
uno::Reference< io::XInputStream >
UpdateInformationProvider::load(const rtl::OUString& rURL)
{
- beans::PropertyValue aURLValue;
- aURLValue.Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- aURLValue.Value <<= rURL;
+ uno::Reference< ucb::XContentIdentifier > xId = m_xContentIdFactory->createContentIdentifier(rURL);
- uno::Sequence< beans::PropertyValue > aValues( 1 );
- aValues[0] = aURLValue;
+ if( !xId.is() )
+ throw uno::RuntimeException(
+ UNISTRING( "unable to obtain universal content id" ), *this);
+
+ uno::Reference< ucb::XCommandProcessor > xCommandProcessor(m_xContentProvider->queryContent(xId), uno::UNO_QUERY_THROW);
+ rtl::Reference< ActiveDataSink > aSink(new ActiveDataSink());
+
+ ucb::OpenCommandArgument2 aOpenArgument;
+ aOpenArgument.Mode = ucb::OpenMode::DOCUMENT;
+ aOpenArgument.Priority = 32768;
+ aOpenArgument.Sink = *aSink;
+
+ ucb::Command aCommand;
+ aCommand.Name = UNISTRING("open");
+ aCommand.Argument = uno::makeAny(aOpenArgument);
+
+ sal_Int32 nCommandId = xCommandProcessor->createCommandIdentifier();
+
+ storeCommandInfo(nCommandId, xCommandProcessor);
+ try
+ {
+ uno::Any aResult = xCommandProcessor->execute(aCommand, nCommandId,
+ static_cast < XCommandEnvironment *> (this));
+ }
+ catch( const uno::Exception & /* e */ )
+ {
+ storeCommandInfo(0, uno::Reference< ucb::XCommandProcessor > ());
+
+ uno::Reference< ucb::XCommandProcessor2 > xCommandProcessor2(xCommandProcessor, uno::UNO_QUERY);
+ if( xCommandProcessor2.is() )
+ xCommandProcessor2->releaseCommandIdentifier(nCommandId);
+
+ throw;
+ }
+ storeCommandInfo(0, uno::Reference< ucb::XCommandProcessor > ());
- ::comphelper::MediaDescriptor aMediaDesc( aValues );
- aMediaDesc.addInputStream();
+ uno::Reference< ucb::XCommandProcessor2 > xCommandProcessor2(xCommandProcessor, uno::UNO_QUERY);
+ if( xCommandProcessor2.is() )
+ xCommandProcessor2->releaseCommandIdentifier(nCommandId);
- return aMediaDesc.getUnpackedValueOrDefault( ::comphelper::MediaDescriptor::PROP_INPUTSTREAM(), uno::Reference< io::XInputStream >() );
+ return INPUT_STREAM(aSink->getInputStream());
}
//------------------------------------------------------------------------------