summaryrefslogtreecommitdiffstats
path: root/connectivity/source
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-14 18:08:57 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-14 18:24:49 +0200
commit9ac86f484b0c278aafbce685ed19d3ea005ee8f8 (patch)
treecf2fe16d76992bcbd1bd89a8693c5f4996cd55f2 /connectivity/source
parentfdo#46808, Adapt ucb::UniversalContentBroker UNO service to new style (diff)
downloadcore-9ac86f484b0c278aafbce685ed19d3ea005ee8f8.tar.gz
core-9ac86f484b0c278aafbce685ed19d3ea005ee8f8.zip
Improvement on previous commit, UCB clean up
* As UCB is only ever initialized with "Local"/"Office", remove this configuration vector completely. The "create" ctor creates an instance internally initialized with those "Local"/"Office" keys. Special (test) code can still instantiate an uninitialized one via plain createInstance. And for backwards compatilibity process startup still ensures to create an initialized instance early, in case there is still code out there (in extensions) that later calls plain createInstance and expects to get the already-initialized (single) instance. * XInitialization is an "implementation detail" of the UniversalContentBroker service, do not expose in XUniversalContentBroker. * ucbhelper/configurationkeys.hxx is no longer needed and is removed. * ucbhelper/contentbroker.hxx is an empty wrapper and is removed; however, that requires ucbhelper::Content constructors to take explicit XComponentContext arguments now. * The only remaining code in ucbhelper/source/client/contentbroker.cxx is Android-only InitUCBHelper. Is that relevant still? Change-Id: I3f7bddd0456bffbcd13590c66d9011915c760f28
Diffstat (limited to 'connectivity/source')
-rw-r--r--connectivity/source/drivers/dbase/DDatabaseMetaData.cxx3
-rw-r--r--connectivity/source/drivers/dbase/DTable.cxx17
-rw-r--r--connectivity/source/drivers/file/FConnection.cxx9
-rw-r--r--connectivity/source/drivers/file/FDatabaseMetaData.cxx32
4 files changed, 29 insertions, 32 deletions
diff --git a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
index f453e9b20bc2..9cd9613a082d 100644
--- a/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/dbase/DDatabaseMetaData.cxx
@@ -30,6 +30,7 @@
#include "dbase/DIndex.hxx"
#include "connectivity/FValue.hxx"
#include <comphelper/extract.hxx>
+#include <comphelper/processfactory.hxx>
#include <comphelper/types.hxx>
#include <ucbhelper/content.hxx>
#include <rtl/logfile.hxx>
@@ -378,7 +379,7 @@ sal_Bool SAL_CALL ODbaseDatabaseMetaData::isReadOnly( ) throw(SQLException, Run
sal_Bool bReadOnly = sal_False;
static ::rtl::OUString sReadOnly( "IsReadOnly" );
- ::ucbhelper::Content aFile(m_pConnection->getContent(),Reference< XCommandEnvironment >());
+ ::ucbhelper::Content aFile(m_pConnection->getContent(),Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
aFile.getPropertyValue(sReadOnly) >>= bReadOnly;
return bReadOnly;
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx
index 9bd6c0e868fc..28d4436931ec 100644
--- a/connectivity/source/drivers/dbase/DTable.cxx
+++ b/connectivity/source/drivers/dbase/DTable.cxx
@@ -29,6 +29,7 @@
#include <tools/config.hxx>
#include "dbase/DIndex.hxx"
#include "dbase/DIndexes.hxx"
+#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <svl/zforlist.hxx>
#include <unotools/syslocale.hxx>
@@ -694,7 +695,7 @@ void ODbaseTable::refreshIndexes()
aURL.setName(rtl::OStringToOUString(aIndexName, m_eEncoding));
try
{
- Content aCnt(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aCnt(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
if (aCnt.isDocument())
{
aVector.push_back(aURL.getBase());
@@ -1051,7 +1052,7 @@ sal_Bool ODbaseTable::CreateImpl()
try
{
- Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
if (aContent.isDocument())
{
// Only if the file exists with length > 0 raise an error
@@ -1078,7 +1079,7 @@ sal_Bool ODbaseTable::CreateImpl()
{
try
{
- Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
aContent.executeCommand( rtl::OUString("delete"),bool2any( sal_True ) );
}
catch(const Exception&) // an exception is thrown when no file exists
@@ -1091,7 +1092,7 @@ sal_Bool ODbaseTable::CreateImpl()
{
String aExt = aURL.getExtension();
aURL.setExtension(rtl::OUString("dbt")); // extension for memo file
- Content aMemo1Content(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aMemo1Content(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
sal_Bool bMemoAlreadyExists = sal_False;
try
@@ -1106,7 +1107,7 @@ sal_Bool ODbaseTable::CreateImpl()
aURL.setExtension(aExt); // kill dbf file
try
{
- Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
aMemoContent.executeCommand( rtl::OUString("delete"),bool2any( sal_True ) );
}
catch(const Exception&)
@@ -1122,7 +1123,7 @@ sal_Bool ODbaseTable::CreateImpl()
if (!CreateMemoFile(aURL))
{
aURL.setExtension(aExt); // kill dbf file
- Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aMemoContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
aMemoContent.executeCommand( rtl::OUString("delete"),bool2any( sal_True ) );
return sal_False;
}
@@ -1460,7 +1461,7 @@ sal_Bool ODbaseTable::Drop_Static(const ::rtl::OUString& _sUrl,sal_Bool _bHasMem
// as the inf file does not necessarily exist, we aren't allowed to use UCBContentHelper::Kill
try
{
- ::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment > () );
+ ::ucbhelper::Content aDeleteContent( aURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
aDeleteContent.executeCommand( ::rtl::OUString("delete"), makeAny( sal_Bool( sal_True ) ) );
}
catch(const Exception&)
@@ -2319,7 +2320,7 @@ namespace
try
{
- Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>());
+ Content aContent(aURL.GetMainURL(INetURLObject::NO_DECODE),Reference<XCommandEnvironment>(), comphelper::getProcessComponentContext());
Sequence< PropertyValue > aProps( 1 );
aProps[0].Name = ::rtl::OUString("Title");
diff --git a/connectivity/source/drivers/file/FConnection.cxx b/connectivity/source/drivers/file/FConnection.cxx
index 4aa2cffc1242..2fa26d5b3a95 100644
--- a/connectivity/source/drivers/file/FConnection.cxx
+++ b/connectivity/source/drivers/file/FConnection.cxx
@@ -17,6 +17,9 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "sal/config.h"
+
+#include <comphelper/processfactory.hxx>
#include <cppuhelper/typeprovider.hxx>
#include "file/FConnection.hxx"
#include "file/FDatabaseMetaData.hxx"
@@ -157,7 +160,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
::ucbhelper::Content aFile;
try
{
- aFile = ::ucbhelper::Content(getURL(),Reference< XCommandEnvironment >());
+ aFile = ::ucbhelper::Content(getURL(), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
}
catch(ContentCreationException& e)
{
@@ -182,7 +185,7 @@ void OConnection::construct(const ::rtl::OUString& url,const Sequence< PropertyV
Reference<XContentIdentifier> xIdent = xParent->getIdentifier();
m_xContent = xParent;
- ::ucbhelper::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >());
+ ::ucbhelper::Content aParent(xIdent->getContentIdentifier(), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
m_xDir = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
}
else
@@ -398,7 +401,7 @@ Reference< XDynamicResultSet > OConnection::getDir() const
try
{
Reference<XContentIdentifier> xIdent = getContent()->getIdentifier();
- ::ucbhelper::Content aParent(xIdent->getContentIdentifier(),Reference< XCommandEnvironment >());
+ ::ucbhelper::Content aParent(xIdent->getContentIdentifier(), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext());
xContent = aParent.createDynamicCursor(aProps, ::ucbhelper::INCLUDE_DOCUMENTS_ONLY );
}
catch(Exception&)
diff --git a/connectivity/source/drivers/file/FDatabaseMetaData.cxx b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
index 61998d2a23aa..86ea5f2b1c9c 100644
--- a/connectivity/source/drivers/file/FDatabaseMetaData.cxx
+++ b/connectivity/source/drivers/file/FDatabaseMetaData.cxx
@@ -24,18 +24,17 @@
#include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
#include <com/sun/star/ucb/SearchRecursion.hpp>
#include <com/sun/star/ucb/SearchCommandArgument.hpp>
+#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <com/sun/star/ucb/XSortedDynamicResultSetFactory.hpp>
-#include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <tools/urlobj.hxx>
#include "file/FDriver.hxx"
#include "file/FTable.hxx"
#include <comphelper/extract.hxx>
-#include <ucbhelper/content.hxx>
-#include <ucbhelper/contentbroker.hxx>
+#include <comphelper/processfactory.hxx>
#include <tools/debug.hxx>
#include <rtl/logfile.hxx>
-
+#include <ucbhelper/content.hxx>
using namespace com::sun::star::ucb;
using namespace connectivity::file;
@@ -94,14 +93,14 @@ namespace
INetURLObject aContentURL( _rFolderOrDoc );
::ucbhelper::Content aContent1;
{
- ::ucbhelper::Content aFolderOrDoc( _rFolderOrDoc, Reference< XCommandEnvironment >() );
+ ::ucbhelper::Content aFolderOrDoc( _rFolderOrDoc, Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
if ( aFolderOrDoc.isDocument() )
aContent1 = aFolderOrDoc;
else
{
aContentURL = INetURLObject( _rFolderOrDoc, INetURLObject::WAS_ENCODED );
aContentURL.Append( _rDocName );
- aContent1 = ::ucbhelper::Content( aContentURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
+ aContent1 = ::ucbhelper::Content( aContentURL.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
}
}
@@ -125,7 +124,7 @@ namespace
::ucbhelper::Content aContent2;
try
{
- aContent2 = ::ucbhelper::Content( aURL2.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >() );
+ aContent2 = ::ucbhelper::Content( aURL2.GetMainURL( INetURLObject::NO_DECODE ), Reference< XCommandEnvironment >(), comphelper::getProcessComponentContext() );
bCanAccess = aContent2.isDocument();
}
catch( const Exception& )
@@ -144,20 +143,13 @@ namespace
Reference< XContentIdentifier > xID1 = xContent1->getIdentifier();
Reference< XContentIdentifier > xID2 = xContent2->getIdentifier();
OSL_ENSURE( xID1.is() && xID2.is(), "isCaseSensitiveParentFolder: invalid ID interfaces!" );
- if ( xID1.is() && xID2.is() )
+ if ( xID1.is() && xID2.is()
+ && ( UniversalContentBroker::create(
+ comphelper::getProcessComponentContext() )->
+ compareContentIds( xID1, xID2 ) == 0 ) )
{
- // get a generic content provider
- ::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
- Reference< XContentProvider > xProvider;
- if ( pBroker )
- xProvider = pBroker->getContentProviderInterface();
- OSL_ENSURE( xProvider.is(), "isCaseSensitiveParentFolder: invalid content broker!" );
- if ( xProvider.is() )
- {
- if ( 0 == xProvider->compareContentIds( xID1, xID2 ) )
- // finally, we know that the folder is not case-sensitive ....
- nIsCS = 0;
- }
+ // finally, we know that the folder is not case-sensitive ....
+ nIsCS = 0;
}
}
}