summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-09-13 11:01:15 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-14 18:24:48 +0200
commit2e284203da7f9882842111265f5f68ea0a145065 (patch)
tree40eb08bffa732c6371bb15eff73a8d2ff18859a3
parent82e94dcaab4534f657458a2461033d686f10cb10 (diff)
fdo#46808, Adapt ucb::UniversalContentBroker UNO service to new style
Create a merged XUniversalContentBroker interface for this service to implement. Which is backwards-compatible, but does not require creating a new service. Change-Id: Id264387bf8af8bf211050e15b8801a1fde368167
-rw-r--r--basic/source/runtime/iosys.cxx10
-rw-r--r--extensions/source/update/check/updateprotocoltest.cxx12
-rw-r--r--extensions/source/update/feed/test/updatefeedtest.cxx12
-rw-r--r--extensions/source/update/feed/updatefeed.cxx27
-rw-r--r--offapi/UnoApi_offapi.mk3
-rw-r--r--offapi/com/sun/star/ucb/UniversalContentBroker.idl121
-rw-r--r--offapi/com/sun/star/ucb/XUniversalContentBroker.idl153
-rw-r--r--offapi/type_reference/types.rdbbin7655424 -> 7655424 bytes
-rw-r--r--svl/source/misc/urihelper.cxx16
-rw-r--r--ucb/source/core/ucb.cxx27
-rw-r--r--ucb/source/core/ucb.hxx20
-rw-r--r--ucbhelper/source/client/contentbroker.cxx21
12 files changed, 229 insertions, 193 deletions
diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx
index 893ba364d75b..4ac4fa400c15 100644
--- a/basic/source/runtime/iosys.cxx
+++ b/basic/source/runtime/iosys.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XSimpleFileAccess2.hpp>
#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XContentProviderManager.hpp>
@@ -276,18 +277,17 @@ bool hasUno( void )
if( bNeedInit )
{
bNeedInit = false;
- Reference< XMultiServiceFactory > xSMgr = getProcessServiceFactory();
- if( !xSMgr.is() )
+ Reference< XComponentContext > xContext = getProcessComponentContext();
+ if( !xContext.is() )
{
// No service manager at all
bRetVal = false;
}
else
{
- Reference< XContentProviderManager > xManager( xSMgr->createInstance(
- ::rtl::OUString( "com.sun.star.ucb.UniversalContentBroker" ) ), UNO_QUERY );
+ Reference< XUniversalContentBroker > xManager = UniversalContentBroker::createDefault(xContext);
- if ( !( xManager.is() && xManager->queryContentProvider( ::rtl::OUString("file:///" ) ).is() ) )
+ if ( !( xManager->queryContentProvider( ::rtl::OUString("file:///" ) ).is() ) )
{
// No UCB
bRetVal = false;
diff --git a/extensions/source/update/check/updateprotocoltest.cxx b/extensions/source/update/check/updateprotocoltest.cxx
index d16d75a5fa69..a1556769567f 100644
--- a/extensions/source/update/check/updateprotocoltest.cxx
+++ b/extensions/source/update/check/updateprotocoltest.cxx
@@ -21,6 +21,7 @@
#include <cppuhelper/bootstrap.hxx>
#include "updateprotocol.hxx"
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <sal/main.h>
#include <osl/process.h>
@@ -48,15 +49,8 @@ SAL_IMPLEMENT_MAIN()
uno::Reference< uno::XComponentContext > rComponentContext = cppu::defaultBootstrap_InitialComponentContext();
// initialize UCB
- uno::Sequence< uno::Any > theArguments(2);
- theArguments[0] = uno::makeAny( UNISTRING( "Local") );
- theArguments[1] = uno::makeAny( UNISTRING( "Office") );
-
- uno::Reference< uno::XInterface > xUCB =
- rComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext(
- UNISTRING( "com.sun.star.ucb.UniversalContentBroker" ),
- theArguments,
- rComponentContext );
+ uno::Reference< uno::XUniversalContentBroker > xUCB =
+ UniversalContentBroker::createWithKeys(rComponentContext, theArguments, "Local", "Office");
rtl::OUString aURL;
diff --git a/extensions/source/update/feed/test/updatefeedtest.cxx b/extensions/source/update/feed/test/updatefeedtest.cxx
index 4819c14ff463..71c0508b70aa 100644
--- a/extensions/source/update/feed/test/updatefeedtest.cxx
+++ b/extensions/source/update/feed/test/updatefeedtest.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/deployment/UpdateInformationProvider.hpp>
#include <sal/main.h>
@@ -55,15 +56,8 @@ SAL_IMPLEMENT_MAIN()
uno::Reference< uno::XComponentContext > rComponentContext = cppu::defaultBootstrap_InitialComponentContext();
// initialize UCB
- uno::Sequence< uno::Any > theArguments(2);
- theArguments[0] = uno::makeAny( UNISTRING( "Local") );
- theArguments[1] = uno::makeAny( UNISTRING( "Office") );
-
- uno::Reference< uno::XInterface > xUCB =
- rComponentContext->getServiceManager()->createInstanceWithArgumentsAndContext(
- UNISTRING( "com.sun.star.ucb.UniversalContentBroker" ),
- theArguments,
- rComponentContext );
+ uno::Reference< uno::XUniversalContentBroker > xUCB =
+ ucb::UniversalContentBroker::createWithKeys(rComponentContext, "Local", "Office");
// retrieve the update information provider
uno::Reference< deployment::XUpdateInformationProvider > rUpdateInformationProvider =
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index 74a29e2004fd..646e2f07236d 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/io/XInputStream.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/ucb/XWebDAVCommandEnvironment.hpp>
#include <com/sun/star/ucb/XCommandProcessor2.hpp>
@@ -209,15 +210,13 @@ private:
uno::Reference< ucb::XCommandProcessor > const & rxCommandProcessor);
UpdateInformationProvider(const uno::Reference<uno::XComponentContext>& xContext,
- const uno::Reference< ucb::XContentIdentifierFactory >& xContentIdFactory,
- const uno::Reference< ucb::XContentProvider >& xContentProvider,
+ const uno::Reference< ucb::XUniversalContentBroker >& xUniversalContentBroker,
const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder,
const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI);
const uno::Reference< uno::XComponentContext> m_xContext;
- const uno::Reference< ucb::XContentIdentifierFactory > m_xContentIdFactory;
- const uno::Reference< ucb::XContentProvider > m_xContentProvider;
+ const uno::Reference< ucb::XUniversalContentBroker > m_xUniversalContentBroker;
const uno::Reference< xml::dom::XDocumentBuilder > m_xDocumentBuilder;
const uno::Reference< xml::xpath::XXPathAPI > m_xXPathAPI;
@@ -330,12 +329,11 @@ private:
UpdateInformationProvider::UpdateInformationProvider(
const uno::Reference<uno::XComponentContext>& xContext,
- const uno::Reference< ucb::XContentIdentifierFactory >& xContentIdFactory,
- const uno::Reference< ucb::XContentProvider >& xContentProvider,
+ const uno::Reference< ucb::XUniversalContentBroker >& xUniversalContentBroker,
const uno::Reference< xml::dom::XDocumentBuilder >& xDocumentBuilder,
const uno::Reference< xml::xpath::XXPathAPI >& xXPathAPI
-) : m_xContext(xContext), m_xContentIdFactory(xContentIdFactory),
- m_xContentProvider(xContentProvider), m_xDocumentBuilder(xDocumentBuilder),
+) : m_xContext(xContext), m_xUniversalContentBroker(xUniversalContentBroker),
+ m_xDocumentBuilder(xDocumentBuilder),
m_xXPathAPI(xXPathAPI), m_aRequestHeaderList(1)
{
uno::Reference< lang::XMultiServiceFactory > xConfigurationProvider(
@@ -409,11 +407,8 @@ UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentCo
UNISTRING( "unable to obtain service manager from component context" ),
uno::Reference< uno::XInterface > ());
- uno::Reference< ucb::XContentIdentifierFactory > xContentIdFactory(
- xServiceManager->createInstanceWithContext( UNISTRING( "com.sun.star.ucb.UniversalContentBroker" ), xContext ),
- uno::UNO_QUERY_THROW);
-
- uno::Reference< ucb::XContentProvider > xContentProvider(xContentIdFactory, uno::UNO_QUERY_THROW);
+ uno::Reference< ucb::XUniversalContentBroker > xUniversalContentBroker =
+ ucb::UniversalContentBroker::createDefault(xContext);
uno::Reference< xml::dom::XDocumentBuilder > xDocumentBuilder(
xml::dom::DocumentBuilder::create(xContext));
@@ -424,7 +419,7 @@ UpdateInformationProvider::createInstance(const uno::Reference<uno::XComponentCo
xXPath->registerNS( UNISTRING("atom"), UNISTRING("http://www.w3.org/2005/Atom") );
- return *new UpdateInformationProvider(xContext, xContentIdFactory, xContentProvider, xDocumentBuilder, xXPath);
+ return *new UpdateInformationProvider(xContext, xUniversalContentBroker, xDocumentBuilder, xXPath);
}
//------------------------------------------------------------------------------
@@ -472,13 +467,13 @@ UpdateInformationProvider::storeCommandInfo(
uno::Reference< io::XInputStream >
UpdateInformationProvider::load(const rtl::OUString& rURL)
{
- uno::Reference< ucb::XContentIdentifier > xId = m_xContentIdFactory->createContentIdentifier(rURL);
+ uno::Reference< ucb::XContentIdentifier > xId = m_xUniversalContentBroker->createContentIdentifier(rURL);
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);
+ uno::Reference< ucb::XCommandProcessor > xCommandProcessor(m_xUniversalContentBroker->queryContent(xId), uno::UNO_QUERY_THROW);
rtl::Reference< ActiveDataSink > aSink(new ActiveDataSink());
// Disable KeepAlive in webdav - don't want millions of office
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 740bf33cd0b9..558747878479 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -288,6 +288,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ucb,\
SimpleFileAccess \
SortedDynamicResultSetFactory \
Store \
+ UniversalContentBroker \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/ui,\
GlobalAcceleratorConfiguration \
@@ -1449,7 +1450,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/ucb,\
TransientDocumentsFolderContent \
TransientDocumentsRootContent \
TransientDocumentsStreamContent \
- UniversalContentBroker \
WebDAVContentProvider \
WebDAVDocumentContent \
WebDAVFolderContent \
@@ -3918,6 +3918,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ucb,\
XSimpleFileAccess3 \
XSortedDynamicResultSetFactory \
XSourceInitialization \
+ XUniversalContentBroker \
XWebDAVCommandEnvironment \
))
$(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/ui,\
diff --git a/offapi/com/sun/star/ucb/UniversalContentBroker.idl b/offapi/com/sun/star/ucb/UniversalContentBroker.idl
index 44fa60623617..6d764341a275 100644
--- a/offapi/com/sun/star/ucb/UniversalContentBroker.idl
+++ b/offapi/com/sun/star/ucb/UniversalContentBroker.idl
@@ -28,13 +28,7 @@
#ifndef __com_sun_star_ucb_UniversalContentBroker_idl__
#define __com_sun_star_ucb_UniversalContentBroker_idl__
-#include <com/sun/star/lang/XComponent.idl>
-#include <com/sun/star/ucb/XCommandProcessor.idl>
-#include <com/sun/star/ucb/XCommandProcessor2.idl>
-#include <com/sun/star/ucb/XContentProviderManager.idl>
-#include <com/sun/star/ucb/XContentProvider.idl>
-#include <com/sun/star/ucb/XContentIdentifierFactory.idl>
-#include <com/sun/star/lang/XInitialization.idl>
+#include <com/sun/star/ucb/XUniversalContentBroker.idl>
module com { module sun { module star { module ucb {
@@ -51,118 +45,11 @@ module com { module sun { module star { module ucb {
<p>If the instance is created without arguments, the newly instantiated
broker is not configured.
*/
-published service UniversalContentBroker
+published service UniversalContentBroker : XUniversalContentBroker
{
- /** must be implemented to make it possible to resolve cyclic object
- references.
-
- <p>Those references i.e. may occur if content provider implementations
- hold references to the Broker. The Broker itself always holds its
- providers. If the Broker shall be released,
- <member scope="com::sun::star::lang">XComponent::dispose</member>
- must be called at the Broker. The implementation of this method must
- call
- <member scope="com::sun::star::lang">XEventListener::disposing</member>
- on the registered listeners (the providers holding the Broker must be
- those listeners) and release the appropriate object references. At
- the other hand, the implementation of XEventListener::disposing must
- release its appropriate references.
-
- <p>This interface is required.
- */
- interface com::sun::star::lang::XComponent;
-
- /** provides access to all kind of contents provided by the registered
- content providers.
-
- <p>This interface is required.
- */
- interface com::sun::star::ucb::XContentProvider;
-
- /** provides access to a set of content providers registered with the UCB.
-
- <p>This interface is required.
- */
- interface com::sun::star::ucb::XContentProviderManager;
-
- /** creates <type>XContentIdentifier</type> implementation objects for
- all kind of contents provided by the UCB.
-
- <p>This interface is required.
- */
- interface com::sun::star::ucb::XContentIdentifierFactory;
-
- /** supports the configuration of a newly created broker.
-
- <p>The
- <member scope="com::sun::star::lang">XInitialization::initialize</member>
- method should be called with two arguments of type string. These strings
- are used as a pair of keys to retrieve a set of content provider
- descriptions from the configuration management (stored at
- <code>org.openoffice.ucb.Configuration.ContentProviders.<var>key<sub>1</sub></var>.SecondaryKeys.<var>key<sub>2</sub></var>.ProviderData</code>
- within the configuration management's hierarchy). The retrieved
- descriptions are in turn used to register the corresponding content
- provider services at the broker.
-
- <p>Typical values for the pair of strings would be
- <code>"Local"</code>/<code>"Office"</code>, to configure a broker that
- contains all the relevant content providers.
-
- <p>This interface is required.
- */
- interface com::sun::star::lang::XInitialization;
-
- /** enables the caller to execute commands at the broker.
-
- <p>This interface is required.
-
- <p><pre>
- =======================================================================
- Commands:
- =======================================================================
-
- [return type]
- [command name]
- [parameter type and name]
-
- -----------------------------------------------------------------------
- Required commands:
- -----------------------------------------------------------------------
-
- // This command obtains an interface which allows to query
- // information on commands supported by the Content Broker.
-
- <type>XCommandInfo</type>
- getCommandInfo
- void
-
- // This command transfers Contents from one location to another.
- // Additionally, it can be used to create a link to a Content.
- // The implementation must be able to handle Contents provided
- // by any Content Provider. This is different from the command
- // "transfer" that can be supported by a Content. That command
- // typically can only handle <type>Content</type>s provided by one
- // <type>ContentProvider</type>.
-
- void
- globalTransfer
- <type>GlobalTransferCommandArgument</type>
- </pre>
- */
- interface com::sun::star::ucb::XCommandProcessor;
-
- /** is an enhanced version of <type>XCommandProcessor</type> that has an
- additional method for releasing command identifiers obtained via
- <member>XCommandProcessor::createCommandIdentifier</member> to avoid
- resource leaks. For a detailed description of the problem refer to
- <member>XCommandProcessor2::releaseCommandIdentifier</member>.
-
- <p>Where many existing <type>UniversalContentBroker</type>
- implementations do not (yet), every new implementation should support
- this interface.
- */
- [optional] interface com::sun::star::ucb::XCommandProcessor2;
+ createDefault();
+ createWithKeys([in] string primaryConfigKey, [in] string secondaryConfigKey);
};
diff --git a/offapi/com/sun/star/ucb/XUniversalContentBroker.idl b/offapi/com/sun/star/ucb/XUniversalContentBroker.idl
new file mode 100644
index 000000000000..ff0313e2fc89
--- /dev/null
+++ b/offapi/com/sun/star/ucb/XUniversalContentBroker.idl
@@ -0,0 +1,153 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+#ifndef __com_sun_star_ucb_XUniversalContentBroker_idl__
+#define __com_sun_star_ucb_XUniversalContentBroker_idl__
+
+#include <com/sun/star/lang/XComponent.idl>
+#include <com/sun/star/ucb/XCommandProcessor.idl>
+#include <com/sun/star/ucb/XCommandProcessor2.idl>
+#include <com/sun/star/ucb/XContentProviderManager.idl>
+#include <com/sun/star/ucb/XContentProvider.idl>
+#include <com/sun/star/ucb/XContentIdentifierFactory.idl>
+#include <com/sun/star/lang/XInitialization.idl>
+
+
+module com { module sun { module star { module ucb {
+
+/**
+
+ @since LibreOffice 3.7
+*/
+published interface XUniversalContentBroker
+{
+ /** must be implemented to make it possible to resolve cyclic object
+ references.
+
+ <p>Those references i.e. may occur if content provider implementations
+ hold references to the Broker. The Broker itself always holds its
+ providers. If the Broker shall be released,
+ <member scope="com::sun::star::lang">XComponent::dispose</member>
+ must be called at the Broker. The implementation of this method must
+ call
+ <member scope="com::sun::star::lang">XEventListener::disposing</member>
+ on the registered listeners (the providers holding the Broker must be
+ those listeners) and release the appropriate object references. At
+ the other hand, the implementation of XEventListener::disposing must
+ release its appropriate references.
+
+ <p>This interface is required.
+ */
+ interface com::sun::star::lang::XComponent;
+
+ /** provides access to all kind of contents provided by the registered
+ content providers.
+
+ <p>This interface is required.
+ */
+ interface com::sun::star::ucb::XContentProvider;
+
+ /** provides access to a set of content providers registered with the UCB.
+
+ <p>This interface is required.
+ */
+ interface com::sun::star::ucb::XContentProviderManager;
+
+ /** creates <type>XContentIdentifier</type> implementation objects for
+ all kind of contents provided by the UCB.
+
+ <p>This interface is required.
+ */
+ interface com::sun::star::ucb::XContentIdentifierFactory;
+
+ /** supports the configuration of a newly created broker.
+
+ <p>The
+ <member scope="com::sun::star::lang">XInitialization::initialize</member>
+ method should be called with two arguments of type string. These strings
+ are used as a pair of keys to retrieve a set of content provider
+ descriptions from the configuration management (stored at
+ <code>org.openoffice.ucb.Configuration.ContentProviders.<var>key<sub>1</sub></var>.SecondaryKeys.<var>key<sub>2</sub></var>.ProviderData</code>
+ within the configuration management's hierarchy). The retrieved
+ descriptions are in turn used to register the corresponding content
+ provider services at the broker.
+
+ <p>Typical values for the pair of strings would be
+ <code>"Local"</code>/<code>"Office"</code>, to configure a broker that
+ contains all the relevant content providers.
+
+ <p>This interface is required.
+ */
+ interface com::sun::star::lang::XInitialization;
+
+ /** Enables the caller to execute commands at the broker.
+
+ Is an enhanced version of <type>XCommandProcessor</type> that has an
+ additional method for releasing command identifiers obtained via
+ <member>XCommandProcessor::createCommandIdentifier</member> to avoid
+ resource leaks. For a detailed description of the problem refer to
+ <member>XCommandProcessor2::releaseCommandIdentifier</member>.
+
+
+ <p>This interface is required.
+
+ <p><pre>
+ =======================================================================
+ Commands:
+ =======================================================================
+
+ [return type]
+ [command name]
+ [parameter type and name]
+
+ -----------------------------------------------------------------------
+ Required commands:
+ -----------------------------------------------------------------------
+
+ // This command obtains an interface which allows to query
+ // information on commands supported by the Content Broker.
+
+ <type>XCommandInfo</type>
+ getCommandInfo
+ void
+
+ // This command transfers Contents from one location to another.
+ // Additionally, it can be used to create a link to a Content.
+ // The implementation must be able to handle Contents provided
+ // by any Content Provider. This is different from the command
+ // "transfer" that can be supported by a Content. That command
+ // typically can only handle <type>Content</type>s provided by one
+ // <type>ContentProvider</type>.
+
+ void
+ globalTransfer
+ <type>GlobalTransferCommandArgument</type>
+ </pre>
+
+ */
+ interface com::sun::star::ucb::XCommandProcessor2;
+
+};
+
+
+}; }; }; };
+
+#endif
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb
index 753f0bcddc16..674109c7195f 100644
--- a/offapi/type_reference/types.rdb
+++ b/offapi/type_reference/types.rdb
Binary files differ
diff --git a/svl/source/misc/urihelper.cxx b/svl/source/misc/urihelper.cxx
index a080eda28095..23340841999c 100644
--- a/svl/source/misc/urihelper.cxx
+++ b/svl/source/misc/urihelper.cxx
@@ -21,6 +21,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include "com/sun/star/lang/WrappedTargetRuntimeException.hpp"
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
+#include "com/sun/star/ucb/UniversalContentBroker.hpp"
#include "com/sun/star/ucb/Command.hpp"
#include <com/sun/star/ucb/FileSystemNotation.hpp>
#include "com/sun/star/ucb/IllegalIdentifierException.hpp"
@@ -286,22 +287,11 @@ URIHelper::normalizedMakeRelative(
rtl::OUString const & baseUriReference, rtl::OUString const & uriReference)
{
OSL_ASSERT(context.is());
- css::uno::Reference< css::lang::XMultiComponentFactory > componentFactory(
- context->getServiceManager());
- if (!componentFactory.is()) {
- throw css::uno::RuntimeException("component context has no service manager",
- css::uno::Reference< css::uno::XInterface >());
- }
- css::uno::Sequence< css::uno::Any > args(2);
- args[0] <<= rtl::OUString("Local");
- args[1] <<= rtl::OUString("Office");
css::uno::Reference< css::ucb::XContentProvider > broker;
try {
broker = css::uno::Reference< css::ucb::XContentProvider >(
- componentFactory->createInstanceWithArgumentsAndContext(
- "com.sun.star.ucb.UniversalContentBroker",
- args, context),
- css::uno::UNO_QUERY_THROW);
+ css::ucb::UniversalContentBroker::createWithKeys(context, "Local", "Office"),
+ css::uno::UNO_QUERY_THROW);
} catch (css::uno::RuntimeException &) {
throw;
} catch (css::uno::Exception &) {
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index 64a412b778b7..4d454c2e4f30 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -269,7 +269,8 @@ UniversalContentBroker::~UniversalContentBroker()
//
//=========================================================================
-XINTERFACE_IMPL_8( UniversalContentBroker,
+XINTERFACE_IMPL_9( UniversalContentBroker,
+ XUniversalContentBroker,
XTypeProvider,
XComponent,
XServiceInfo,
@@ -285,13 +286,14 @@ XINTERFACE_IMPL_8( UniversalContentBroker,
//
//=========================================================================
-XTYPEPROVIDER_IMPL_8( UniversalContentBroker,
- XTypeProvider,
+XTYPEPROVIDER_IMPL_9( UniversalContentBroker,
+ XUniversalContentBroker,
+ XTypeProvider,
XComponent,
- XServiceInfo,
+ XServiceInfo,
XInitialization,
- XContentProviderManager,
- XContentProvider,
+ XContentProviderManager,
+ XContentProvider,
XContentIdentifierFactory,
XCommandProcessor );
@@ -676,6 +678,19 @@ Any SAL_CALL UniversalContentBroker::execute(
}
//=========================================================================
+//
+// XCommandProcessor2 methods.
+//
+//=========================================================================
+
+// virtual
+void SAL_CALL UniversalContentBroker::releaseCommandIdentifier(sal_Int32 /*aCommandId*/)
+ throw( RuntimeException )
+{
+ // @@@ Not implemeted ( yet).
+}
+
+//=========================================================================
// virtual
void SAL_CALL UniversalContentBroker::abort( sal_Int32 )
throw( RuntimeException )
diff --git a/ucb/source/core/ucb.hxx b/ucb/source/core/ucb.hxx
index 265457126323..f12386fe94ab 100644
--- a/ucb/source/core/ucb.hxx
+++ b/ucb/source/core/ucb.hxx
@@ -20,13 +20,10 @@
#ifndef _UCB_HXX
#define _UCB_HXX
-#include <com/sun/star/ucb/XCommandProcessor.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
-#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
-#include <com/sun/star/ucb/XContentProviderManager.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
+
+#include <com/sun/star/ucb/XUniversalContentBroker.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
#include <com/sun/star/util/XChangesListener.hpp>
@@ -57,14 +54,9 @@ namespace com { namespace sun { namespace star { namespace ucb {
class UniversalContentBroker :
public cppu::OWeakObject,
+ public com::sun::star::ucb::XUniversalContentBroker,
public com::sun::star::lang::XTypeProvider,
- public com::sun::star::lang::XComponent,
public com::sun::star::lang::XServiceInfo,
- public com::sun::star::lang::XInitialization,
- public com::sun::star::ucb::XContentProviderManager,
- public com::sun::star::ucb::XContentProvider,
- public com::sun::star::ucb::XContentIdentifierFactory,
- public com::sun::star::ucb::XCommandProcessor,
public com::sun::star::util::XChangesListener
{
public:
@@ -161,6 +153,10 @@ public:
abort( sal_Int32 CommandId )
throw( com::sun::star::uno::RuntimeException );
+ // XCommandProcessor2
+ virtual void SAL_CALL releaseCommandIdentifier(sal_Int32 aCommandId)
+ throw( com::sun::star::uno::RuntimeException );
+
// XChangesListener
virtual void SAL_CALL changesOccurred( const com::sun::star::util::ChangesEvent& Event )
throw( com::sun::star::uno::RuntimeException );
diff --git a/ucbhelper/source/client/contentbroker.cxx b/ucbhelper/source/client/contentbroker.cxx
index bd85d2f5076b..219a7a13d077 100644
--- a/ucbhelper/source/client/contentbroker.cxx
+++ b/ucbhelper/source/client/contentbroker.cxx
@@ -26,8 +26,10 @@
#include <osl/diagnose.h>
#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XContentIdentifierFactory.hpp>
#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/ucb/XContentProviderManager.hpp>
@@ -40,6 +42,7 @@
#include <ucbhelper/configurationkeys.hxx>
#endif
+using namespace com::sun::star::beans;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::uno;
@@ -310,13 +313,21 @@ bool ContentBroker_Impl::initialize()
{
try
{
- xIfc = m_xSMgr->createInstanceWithArguments(
- OUString(
- "com.sun.star.ucb.UniversalContentBroker" ),
- m_aArguments );
+ Reference< XPropertySet > xFactoryProperties( m_xSMgr, UNO_QUERY_THROW );
+ Reference< XComponentContext > xContext( xFactoryProperties->getPropertyValue( "DefaultContext" ), UNO_QUERY_THROW );
+ if( m_aArguments.getLength() == 0 )
+ xIfc = UniversalContentBroker::createDefault(xContext);
+ else
+ {
+ rtl::OUString aPrimaryConfigKey, aSecondaryConfigKey;
+ m_aArguments[0] >>= aPrimaryConfigKey;
+ m_aArguments[1] >>= aSecondaryConfigKey;
+ xIfc = UniversalContentBroker::createWithKeys(xContext, aPrimaryConfigKey, aSecondaryConfigKey);
+ }
}
- catch ( Exception const & )
+ catch ( const Exception & e)
{
+ SAL_WARN("ucbhelper", "exception while initialising UniversalContentBroker " << e.Message);
}
}