summaryrefslogtreecommitdiff
path: root/ucb
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-30 14:02:56 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-10-31 15:31:36 +0100
commit0ac9a10d312dc8f12a74720ce211823ce4addf7b (patch)
tree2c812432eca9315170af8b5b6b7ae5bcbf828d5b /ucb
parentd27c92961b78da138d3563ab596cca416af9eb38 (diff)
fdo#46808, Deprecate configuration::ConfigurationProvider old-style service
...in favor of existing new-style configuration::theDefaultProvider singleton. Theoretically, ConfigurationProvider instances can be created with specific Locale and EnableAsync arguments, but this is hardly used in practice, and thus effectively all uses of the ConfigurationProvider service use the theDefaultProvider instance, anyway. theDefaultProvider is restricted to the XMultiServiceFactory interface, while ConfigurationProvider also makes available XComponent. However, dispose must not be called manually on theDefaultProvider singleton anyway, and calls to add-/removeEventListener are so few (and in dubious code that should better be cleaned up) that requiring an explicit queryInterface does not really hurt there. This commit originated as a patch by Noel Grandin to "Adapt configuration::ConfigurationProvider UNO service to new style [by creating] a merged XConfigurationProvider interface for this service to implement." It was then modified by Stephan Bergmann by deprecating ConfigurationProvider instead of adding XConfigurationProvider and by replacing calls to ConfigurationProvider::create with calls to theDefaultProvider::get. Change-Id: I9c16700afe0faff1ef6f20338a66bd7a9af990bd
Diffstat (limited to 'ucb')
-rw-r--r--ucb/source/core/ucb.cxx9
-rw-r--r--ucb/source/ucp/ftp/ftpcontentprovider.cxx2
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydatasource.cxx20
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydatasource.hxx7
-rw-r--r--ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx16
-rw-r--r--ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx4
-rw-r--r--ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx6
-rw-r--r--ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx10
-rw-r--r--ucb/source/ucp/webdav-neon/NeonSession.cxx6
-rw-r--r--ucb/source/ucp/webdav-neon/NeonSession.hxx4
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontent.cxx6
11 files changed, 40 insertions, 50 deletions
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index ee3926c639ad..8a30605561b1 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -24,6 +24,7 @@
*************************************************************************/
#include <osl/diagnose.h>
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/ucb/GlobalTransferCommandArgument2.hpp>
@@ -33,6 +34,7 @@
#include <com/sun/star/ucb/XParameterizedContentProvider.hpp>
#include <com/sun/star/ucb/XContentProviderFactory.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/uno/Any.hxx>
@@ -878,11 +880,8 @@ bool UniversalContentBroker::getContentProviderData(
try
{
- uno::Reference< lang::XMultiServiceFactory > xConfigProv(
- m_xSMgr->createInstance(
- OUString(
- "com.sun.star.configuration.ConfigurationProvider" ) ),
- uno::UNO_QUERY_THROW );
+ uno::Reference< lang::XMultiServiceFactory > xConfigProv =
+ configuration::theDefaultProvider::get( comphelper::getComponentContext(m_xSMgr) );
OUStringBuffer aFullPath;
aFullPath.appendAscii( CONFIG_CONTENTPROVIDERS_KEY "/['" );
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index 9eff7864dc85..ee57e6d263c9 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -178,7 +178,7 @@ FTPContentProvider::queryContent(
void FTPContentProvider::init() {
m_ftpLoaderThread = new FTPLoaderThread();
- m_pProxyDecider = new ucbhelper::InternetProxyDecider(m_xSMgr);
+ m_pProxyDecider = new ucbhelper::InternetProxyDecider(comphelper::getComponentContext(m_xSMgr));
}
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
index 574cff078a54..a6fd1d376ca1 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
@@ -30,8 +30,10 @@
#include <osl/diagnose.h>
#include "osl/doublecheckedlocking.h"
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
@@ -50,8 +52,6 @@ using namespace hierarchy_ucp;
#define READ_SERVICE_NAME "com.sun.star.ucb.HierarchyDataReadAccess"
#define READWRITE_SERVICE_NAME "com.sun.star.ucb.HierarchyDataReadWriteAccess"
-#define CONFIG_PROVIDER_SERVICE_NAME \
- "com.sun.star.configuration.ConfigurationProvider"
#define CONFIG_READ_SERVICE_NAME \
"com.sun.star.configuration.ConfigurationAccess"
#define CONFIG_READWRITE_SERVICE_NAME \
@@ -213,8 +213,8 @@ using namespace hcp_impl;
//=========================================================================
HierarchyDataSource::HierarchyDataSource(
- const uno::Reference< lang::XMultiServiceFactory > & rxServiceMgr )
-: m_xSMgr( rxServiceMgr ),
+ const uno::Reference< uno::XComponentContext > & rxContext )
+: m_xContext( rxContext ),
m_pDisposeEventListeners( 0 )
{
}
@@ -256,7 +256,7 @@ XTYPEPROVIDER_IMPL_4( HierarchyDataSource,
//
//=========================================================================
-XSERVICEINFO_IMPL_0( HierarchyDataSource,
+XSERVICEINFO_IMPL_0_CTX( HierarchyDataSource,
rtl::OUString( "com.sun.star.comp.ucb.HierarchyDataSource" ) )
{
uno::Sequence< rtl::OUString > aSNS( 2 );
@@ -524,15 +524,7 @@ HierarchyDataSource::getConfigProvider()
{
try
{
- m_xConfigProvider
- = uno::Reference< lang::XMultiServiceFactory >(
- m_xSMgr->createInstance(
- rtl::OUString( CONFIG_PROVIDER_SERVICE_NAME ) ),
- uno::UNO_QUERY );
-
- OSL_ENSURE( m_xConfigProvider.is(),
- "HierarchyDataSource::getConfigProvider - "
- "No configuration provider!" );
+ m_xConfigProvider = configuration::theDefaultProvider::get( m_xContext );
}
catch ( uno::Exception const & )
{
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx
index f8994a882eaf..65b00d3d6ea4 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XTypeProvider.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/weak.hxx>
#include <ucbhelper/macros.hxx>
@@ -42,15 +43,15 @@ class HierarchyDataSource : public cppu::OWeakObject,
{
osl::Mutex m_aMutex;
com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ com::sun::star::uno::XComponentContext > m_xContext;
com::sun::star::uno::Reference<
com::sun::star::lang::XMultiServiceFactory > m_xConfigProvider;
cppu::OInterfaceContainerHelper * m_pDisposeEventListeners;
public:
HierarchyDataSource( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > &
- rxServiceMgr );
+ com::sun::star::uno::XComponentContext > &
+ rxContext );
virtual ~HierarchyDataSource();
// XInterface
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
index b001e1444f2e..96fdd68d10af 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.cxx
@@ -139,12 +139,12 @@ int DAVAuthListener_Impl::authenticate(
//=========================================================================
DAVResourceAccess::DAVResourceAccess(
- const uno::Reference< lang::XMultiServiceFactory > & rSMgr,
+ const uno::Reference< uno::XComponentContext > & rxContext,
rtl::Reference< DAVSessionFactory > const & rSessionFactory,
const rtl::OUString & rURL )
: m_aURL( rURL ),
m_xSessionFactory( rSessionFactory ),
- m_xSMgr( rSMgr )
+ m_xContext( rxContext )
{
}
@@ -155,7 +155,7 @@ DAVResourceAccess::DAVResourceAccess( const DAVResourceAccess & rOther )
m_aFlags( rOther.m_aFlags ),
m_xSession( rOther.m_xSession ),
m_xSessionFactory( rOther.m_xSessionFactory ),
- m_xSMgr( rOther.m_xSMgr ),
+ m_xContext( rOther.m_xContext ),
m_aRedirectURIs( rOther.m_aRedirectURIs )
{
}
@@ -169,7 +169,7 @@ DAVResourceAccess & DAVResourceAccess::operator=(
m_aFlags = rOther.m_aFlags;
m_xSession = rOther.m_xSession;
m_xSessionFactory = rOther.m_xSessionFactory;
- m_xSMgr = rOther.m_xSMgr;
+ m_xContext = rOther.m_xContext;
m_aRedirectURIs = rOther.m_aRedirectURIs;
return *this;
@@ -598,7 +598,7 @@ void DAVResourceAccess::PUT(
// Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream
= comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
- rStream, comphelper::getComponentContext(m_xSMgr) );
+ rStream, m_xContext );
int errorCount = 0;
bool bRetry = false;
@@ -647,7 +647,7 @@ uno::Reference< io::XInputStream > DAVResourceAccess::POST(
// Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream
= comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
- rInputStream, comphelper::getComponentContext(m_xSMgr) );
+ rInputStream, m_xContext );
uno::Reference< io::XInputStream > xStream;
int errorCount = 0;
@@ -711,7 +711,7 @@ void DAVResourceAccess::POST(
// Make stream seekable, if it not. Needed, if request must be retried.
uno::Reference< io::XInputStream > xSeekableStream
= comphelper::OSeekableInputWrapper::CheckSeekableCanWrap(
- rInputStream, comphelper::getComponentContext(m_xSMgr) );
+ rInputStream, m_xContext );
int errorCount = 0;
bool bRetry = false;
@@ -1082,7 +1082,7 @@ void DAVResourceAccess::initialize()
// create new webdav session
m_xSession
- = m_xSessionFactory->createDAVSession( m_aURL, m_aFlags, m_xSMgr );
+ = m_xSessionFactory->createDAVSession( m_aURL, m_aFlags, m_xContext );
if ( !m_xSession.is() )
return;
diff --git a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx
index 30770b06e3c1..99446236bf69 100644
--- a/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVResourceAccess.hxx
@@ -59,13 +59,13 @@ class DAVResourceAccess
rtl::Reference< DAVSession > m_xSession;
rtl::Reference< DAVSessionFactory > m_xSessionFactory;
com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > m_xSMgr;
+ com::sun::star::uno::XComponentContext > m_xContext;
std::vector< NeonUri > m_aRedirectURIs;
public:
DAVResourceAccess() : m_xSessionFactory( 0 ) {}
DAVResourceAccess( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > & rSMgr,
+ com::sun::star::uno::XComponentContext > & rxContext,
rtl::Reference<
DAVSessionFactory > const & rSessionFactory,
const rtl::OUString & rURL );
diff --git a/ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx b/ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx
index 661799ae58d8..2534af78f628 100644
--- a/ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx
+++ b/ucb/source/ucp/webdav-neon/DAVSessionFactory.cxx
@@ -41,15 +41,15 @@ DAVSessionFactory::~DAVSessionFactory()
rtl::Reference< DAVSession > DAVSessionFactory::createDAVSession(
const ::rtl::OUString & inUri,
const uno::Sequence< beans::NamedValue >& rFlags,
- const uno::Reference< lang::XMultiServiceFactory > & rxSMgr )
+ const uno::Reference< uno::XComponentContext > & rxContext )
throw( DAVException )
{
- m_xMSF = rxSMgr;
+ m_xContext = rxContext;
osl::MutexGuard aGuard( m_aMutex );
if ( !m_xProxyDecider.get() )
- m_xProxyDecider.reset( new ucbhelper::InternetProxyDecider( rxSMgr ) );
+ m_xProxyDecider.reset( new ucbhelper::InternetProxyDecider( rxContext ) );
Map::iterator aIt( m_aMap.begin() );
Map::iterator aEnd( m_aMap.end() );
diff --git a/ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx b/ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx
index 4e642c42af86..c29ec718e86f 100644
--- a/ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx
+++ b/ucb/source/ucp/webdav-neon/DAVSessionFactory.hxx
@@ -62,13 +62,11 @@ public:
rtl::Reference< DAVSession >
createDAVSession( const ::rtl::OUString & inUri,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& rFlags,
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::lang::XMultiServiceFactory >&
- rxSMgr )
+ const ::uno::Sequence< ::com::sun::star::beans::NamedValue >& rFlags,
+ const ::uno::Reference< ::uno::XComponentContext >& rxContext )
throw( DAVException );
- ::uno::Reference< ::lang::XMultiServiceFactory > getServiceFactory() { return m_xMSF; }
+ ::uno::Reference< ::uno::XComponentContext > getComponentContext() { return m_xContext; }
private:
typedef std::map< rtl::OUString, DAVSession * > Map;
@@ -76,7 +74,7 @@ private:
osl::Mutex m_aMutex;
std::auto_ptr< ucbhelper::InternetProxyDecider > m_xProxyDecider;
- ::uno::Reference< ::lang::XMultiServiceFactory > m_xMSF;
+ ::uno::Reference< ::uno::XComponentContext > m_xContext;
void releaseElement( DAVSession * pElement ) SAL_THROW(());
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index d05973fc53f7..0d6f931d0635 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -407,7 +407,7 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
uno::Reference< security::XCertificateContainer > xCertificateContainer;
try
{
- xCertificateContainer = security::CertificateContainer::create( comphelper::getComponentContext( pSession->getMSF() ) );
+ xCertificateContainer = security::CertificateContainer::create( pSession->getComponentContext() );
}
catch ( uno::Exception const & )
{
@@ -437,8 +437,8 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
try
{
xSEInitializer = uno::Reference< xml::crypto::XSEInitializer >(
- pSession->getMSF()->createInstance(
- rtl::OUString( SEINITIALIZER_COMPONENT ) ),
+ pSession->getComponentContext()->getServiceManager()->createInstanceWithContext(
+ SEINITIALIZER_COMPONENT, pSession->getComponentContext()),
uno::UNO_QUERY );
}
catch ( uno::Exception const & )
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.hxx b/ucb/source/ucp/webdav-neon/NeonSession.hxx
index f15eac408c4e..15c88bb72ffc 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.hxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.hxx
@@ -225,8 +225,8 @@ public:
const rtl::OUString & getHostName() const { return m_aHostName; }
- const ::uno::Reference< ::lang::XMultiServiceFactory > getMSF()
- { return m_xFactory->getServiceFactory(); }
+ const ::uno::Reference< ::uno::XComponentContext > getComponentContext()
+ { return m_xFactory->getComponentContext(); }
const void * getRequestData() const { return m_pRequestData; }
diff --git a/ucb/source/ucp/webdav-neon/webdavcontent.cxx b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
index bfabf8cedfac..9034c8632d1f 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontent.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontent.cxx
@@ -117,7 +117,7 @@ Content::Content(
try
{
m_xResAccess.reset( new DAVResourceAccess(
- rxSMgr,
+ comphelper::getComponentContext(rxSMgr),
rSessionFactory,
Identifier->getContentIdentifier() ) );
@@ -149,7 +149,7 @@ Content::Content(
try
{
m_xResAccess.reset( new DAVResourceAccess(
- rxSMgr, rSessionFactory, Identifier->getContentIdentifier() ) );
+ comphelper::getComponentContext(rxSMgr), rSessionFactory, Identifier->getContentIdentifier() ) );
}
catch ( DAVException const & )
{
@@ -2514,7 +2514,7 @@ void Content::transfer(
uno::Reference< ucb::XContentIdentifier > xTargetId
= new ::ucbhelper::ContentIdentifier( xSMgr, aTargetURL );
- DAVResourceAccess aSourceAccess( xSMgr,
+ DAVResourceAccess aSourceAccess( comphelper::getComponentContext(xSMgr),
xResAccess->getSessionFactory(),
sourceURI.GetURI() );