diff options
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/core/ucb.cxx | 39 | ||||
-rw-r--r-- | ucb/source/core/ucb.hxx | 1 | ||||
-rw-r--r-- | ucb/source/ucp/expand/ucpexpand.cxx | 5 | ||||
-rw-r--r-- | ucb/source/ucp/ext/ucpext_content.cxx | 4 | ||||
-rw-r--r-- | ucb/source/ucp/ext/ucpext_datasupplier.cxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/ftp/ftpcontentprovider.cxx | 24 |
6 files changed, 42 insertions, 33 deletions
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx index 4d454c2e4f30..c3ad4337460f 100644 --- a/ucb/source/core/ucb.cxx +++ b/ucb/source/core/ucb.cxx @@ -372,17 +372,34 @@ void SAL_CALL UniversalContentBroker::initialize( throw( com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException ) { - //@@@ At the moment, there's a problem when one (non-one-instance) factory - // 'wraps' another (one-instance) factory, causing this method to be - // called several times: - m_aArguments = aArguments; - - oslInterlockedCount nCount = osl_incrementInterlockedCount(&m_nInitCount); - if (nCount == 1) - configureUcb(); - else - osl_decrementInterlockedCount(&m_nInitCount); - // make the possibility of overflow less likely... + { + osl::MutexGuard aGuard(m_aMutex); + if (m_aArguments.getLength() != 0) + { + if (aArguments.getLength() != 0 + && !(m_aArguments.getLength() == 2 + && aArguments.getLength() == 2 + && m_aArguments[0] == aArguments[0] + && m_aArguments[1] == aArguments[1])) + { + throw IllegalArgumentException( + "UCB reinitialized with different arguments", + static_cast< cppu::OWeakObject * >(this), 0); + } + return; + } + if (aArguments.getLength() == 0) + { + m_aArguments.realloc(2); + m_aArguments[0] <<= OUString("Local"); + m_aArguments[1] <<= OUString("Office"); + } + else + { + m_aArguments = aArguments; + } + } + configureUcb(); } //========================================================================= diff --git a/ucb/source/core/ucb.hxx b/ucb/source/core/ucb.hxx index f12386fe94ab..8cd61e413f0a 100644 --- a/ucb/source/core/ucb.hxx +++ b/ucb/source/core/ucb.hxx @@ -57,6 +57,7 @@ class UniversalContentBroker : public com::sun::star::ucb::XUniversalContentBroker, public com::sun::star::lang::XTypeProvider, public com::sun::star::lang::XServiceInfo, + public com::sun::star::lang::XInitialization, public com::sun::star::util::XChangesListener { public: diff --git a/ucb/source/ucp/expand/ucpexpand.cxx b/ucb/source/ucp/expand/ucpexpand.cxx index 3f75376e1249..4e2aadef6843 100644 --- a/ucb/source/ucp/expand/ucpexpand.cxx +++ b/ucb/source/ucp/expand/ucpexpand.cxx @@ -63,6 +63,7 @@ typedef ::cppu::WeakComponentImplHelper2< //============================================================================== class ExpandContentProviderImpl : protected MutexHolder, public t_impl_helper { + uno::Reference< uno::XComponentContext > m_xComponentContext; uno::Reference< util::XMacroExpander > m_xMacroExpander; OUString expandUri( uno::Reference< ucb::XContentIdentifier > const & xIdentifier ) const; @@ -75,6 +76,7 @@ public: inline ExpandContentProviderImpl( uno::Reference< uno::XComponentContext > const & xComponentContext ) : t_impl_helper( m_mutex ), + m_xComponentContext( xComponentContext ), m_xMacroExpander( xComponentContext->getValueByName( OUSTR("/singletons/com.sun.star.util.theMacroExpander") ), @@ -216,7 +218,8 @@ uno::Reference< ucb::XContent > ExpandContentProviderImpl::queryContent( ::ucbhelper::Content ucb_content; if (::ucbhelper::Content::create( - uri, uno::Reference< ucb::XCommandEnvironment >(), ucb_content )) + uri, uno::Reference< ucb::XCommandEnvironment >(), + m_xComponentContext, ucb_content )) { return ucb_content.get(); } diff --git a/ucb/source/ucp/ext/ucpext_content.cxx b/ucb/source/ucp/ext/ucpext_content.cxx index 6e47cad61aa9..290a49570c6d 100644 --- a/ucb/source/ucp/ext/ucpext_content.cxx +++ b/ucb/source/ucp/ext/ucpext_content.cxx @@ -286,7 +286,7 @@ namespace ucb { namespace ucp { namespace ext if ( aOpenCommand.Sink.is() ) { const ::rtl::OUString sPhysicalContentURL( getPhysicalURL() ); - ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEvironment ); + ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEvironment, comphelper::ComponentContext(m_xSMgr).getUNOContext() ); aRet = aRequestedContent.executeCommand( ::rtl::OUString( "open" ), makeAny( aOpenCommand ) ); } } @@ -502,7 +502,7 @@ namespace ucb { namespace ucp { namespace ext case E_EXTENSION_CONTENT: { const ::rtl::OUString sPhysicalContentURL( getPhysicalURL() ); - ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEnv ); + ::ucbhelper::Content aRequestedContent( sPhysicalContentURL, i_rEnv, comphelper::ComponentContext(m_xSMgr).getUNOContext() ); // translate the property request Sequence< ::rtl::OUString > aPropertyNames( i_rProperties.getLength() ); diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx b/ucb/source/ucp/ext/ucpext_datasupplier.cxx index 29356a7e68e5..aec7058c1f24 100644 --- a/ucb/source/ucp/ext/ucpext_datasupplier.cxx +++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx @@ -178,7 +178,7 @@ namespace ucb { namespace ucp { namespace ext case E_EXTENSION_CONTENT: { const ::rtl::OUString sPackageLocation( m_pImpl->m_xContent->getPhysicalURL() ); - ::ucbhelper::Content aWrappedContent( sPackageLocation, getResultSet()->getEnvironment() ); + ::ucbhelper::Content aWrappedContent( sPackageLocation, getResultSet()->getEnvironment(), comphelper::ComponentContext(m_pImpl->m_xSMgr).getUNOContext() ); // obtain the properties which our result set is set up for from the wrapped content Sequence< ::rtl::OUString > aPropertyNames(1); diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx index a7b281129e62..7d9db3d8b582 100644 --- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx +++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx @@ -33,7 +33,8 @@ *************************************************************************/ -#include <ucbhelper/contentbroker.hxx> +#include <com/sun/star/ucb/UniversalContentBroker.hpp> +#include <comphelper/componentcontext.hxx> #include <osl/socket.hxx> #include "ftpcontentprovider.hxx" #include "ftpcontent.hxx" @@ -258,23 +259,10 @@ FTPContentProvider::getHttpProvider() throw(RuntimeException) { // used for access to ftp-proxy - ucbhelper::ContentBroker *pBroker = ucbhelper::ContentBroker::get(); - - if(pBroker) { - Reference<XContentProviderManager > xManager( - pBroker->getContentProviderManagerInterface()); - - if(xManager.is()) - return - xManager->queryContentProvider( - rtl::OUString("http:")); - else - throw RuntimeException( - rtl::OUString( "bad ucbhelper::ContentBroker"), - *this); - } else - return 0; - + return + UniversalContentBroker::create( + comphelper::ComponentContext(m_xSMgr).getUNOContext())-> + queryContentProvider("http:"); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |