Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
7f635eeb
Kaydet (Commit)
7f635eeb
authored
Şub 04, 2013
tarafından
Ariel Constenla-Haile
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Ensure UNO context propagation on drivers instantiation
Use a better approach than revision 1387711
üst
96bc6d61
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
mdrivermanager.cxx
connectivity/source/manager/mdrivermanager.cxx
+12
-6
mdrivermanager.hxx
connectivity/source/manager/mdrivermanager.hxx
+0
-2
No files found.
connectivity/source/manager/mdrivermanager.cxx
Dosyayı görüntüle @
7f635eeb
...
@@ -119,6 +119,9 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
...
@@ -119,6 +119,9 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
/// an STL functor which ensures that a SdbcDriver described by a DriverAccess is loaded
/// an STL functor which ensures that a SdbcDriver described by a DriverAccess is loaded
struct
EnsureDriver
:
public
::
std
::
unary_function
<
DriverAccess
,
DriverAccess
>
struct
EnsureDriver
:
public
::
std
::
unary_function
<
DriverAccess
,
DriverAccess
>
{
{
EnsureDriver
(
const
Reference
<
XComponentContext
>
&
rxContext
)
:
mxContext
(
rxContext
)
{}
const
DriverAccess
&
operator
()(
const
DriverAccess
&
_rDescriptor
)
const
const
DriverAccess
&
operator
()(
const
DriverAccess
&
_rDescriptor
)
const
{
{
if
(
!
_rDescriptor
.
xDriver
.
is
()
)
if
(
!
_rDescriptor
.
xDriver
.
is
()
)
...
@@ -126,9 +129,12 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
...
@@ -126,9 +129,12 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
if
(
_rDescriptor
.
xComponentFactory
.
is
()
)
if
(
_rDescriptor
.
xComponentFactory
.
is
()
)
// we have a factory for it
// we have a factory for it
const_cast
<
DriverAccess
&
>
(
_rDescriptor
).
xDriver
=
_rDescriptor
.
xDriver
.
query
(
const_cast
<
DriverAccess
&
>
(
_rDescriptor
).
xDriver
=
_rDescriptor
.
xDriver
.
query
(
_rDescriptor
.
xComponentFactory
->
createInstanceWithContext
(
_rDescriptor
.
xUNO
Context
)
);
_rDescriptor
.
xComponentFactory
->
createInstanceWithContext
(
mx
Context
)
);
return
_rDescriptor
;
return
_rDescriptor
;
}
}
private
:
Reference
<
XComponentContext
>
mxContext
;
};
};
//---------------------------------------------------------------------
//---------------------------------------------------------------------
...
@@ -150,7 +156,8 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
...
@@ -150,7 +156,8 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
/// an STL functor which loads a driver described by a DriverAccess, and extracts the SdbcDriver
/// an STL functor which loads a driver described by a DriverAccess, and extracts the SdbcDriver
struct
ExtractAfterLoad
:
public
ExtractAfterLoad_BASE
struct
ExtractAfterLoad
:
public
ExtractAfterLoad_BASE
{
{
ExtractAfterLoad
()
:
ExtractAfterLoad_BASE
(
ExtractDriverFromAccess
(),
EnsureDriver
()
)
{
}
ExtractAfterLoad
(
const
Reference
<
XComponentContext
>
&
rxContext
)
:
ExtractAfterLoad_BASE
(
ExtractDriverFromAccess
(),
EnsureDriver
(
rxContext
)
)
{}
};
};
//---------------------------------------------------------------------
//---------------------------------------------------------------------
...
@@ -338,7 +345,6 @@ void OSDBCDriverManager::bootstrapDrivers()
...
@@ -338,7 +345,6 @@ void OSDBCDriverManager::bootstrapDrivers()
{
// yes -> no need to load the driver immediately (load it later when needed)
{
// yes -> no need to load the driver immediately (load it later when needed)
aDriverDescriptor
.
sImplementationName
=
xSI
->
getImplementationName
();
aDriverDescriptor
.
sImplementationName
=
xSI
->
getImplementationName
();
aDriverDescriptor
.
xComponentFactory
=
xFactory
;
aDriverDescriptor
.
xComponentFactory
=
xFactory
;
aDriverDescriptor
.
xUNOContext
=
m_aContext
.
getUNOContext
();
bValidDescriptor
=
sal_True
;
bValidDescriptor
=
sal_True
;
m_aEventLogger
.
log
(
LogLevel
::
CONFIG
,
m_aEventLogger
.
log
(
LogLevel
::
CONFIG
,
...
@@ -523,7 +529,7 @@ Reference< XEnumeration > SAL_CALL OSDBCDriverManager::createEnumeration( ) thr
...
@@ -523,7 +529,7 @@ Reference< XEnumeration > SAL_CALL OSDBCDriverManager::createEnumeration( ) thr
ODriverEnumeration
::
DriverArray
aDrivers
;
ODriverEnumeration
::
DriverArray
aDrivers
;
// ensure that all our bootstrapped drivers are insatntiated
// ensure that all our bootstrapped drivers are insatntiated
::
std
::
for_each
(
m_aDriversBS
.
begin
(),
m_aDriversBS
.
end
(),
EnsureDriver
()
);
::
std
::
for_each
(
m_aDriversBS
.
begin
(),
m_aDriversBS
.
end
(),
EnsureDriver
(
m_aContext
.
getUNOContext
()
)
);
// copy the bootstrapped drivers
// copy the bootstrapped drivers
::
std
::
transform
(
::
std
::
transform
(
...
@@ -704,13 +710,13 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const ::rtl::OUStri
...
@@ -704,13 +710,13 @@ Reference< XDriver > OSDBCDriverManager::implGetDriverForURL(const ::rtl::OUStri
aFind
=
::
std
::
find_if
(
aFind
=
::
std
::
find_if
(
m_aDriversBS
.
begin
(),
// begin of search range
m_aDriversBS
.
begin
(),
// begin of search range
m_aDriversBS
.
end
(),
// end of search range
m_aDriversBS
.
end
(),
// end of search range
std
::
unary_compose
<
AcceptsURL
,
ExtractAfterLoad
>
(
AcceptsURL
(
_rURL
),
ExtractAfterLoad
()
)
std
::
unary_compose
<
AcceptsURL
,
ExtractAfterLoad
>
(
AcceptsURL
(
_rURL
),
ExtractAfterLoad
(
m_aContext
.
getUNOContext
()
)
)
// compose two functors: extract the driver from the access, then ask the resulting driver for acceptance
// compose two functors: extract the driver from the access, then ask the resulting driver for acceptance
);
);
}
// if ( m_aDriversBS.find(sDriverFactoryName ) == m_aDriversBS.end() )
}
// if ( m_aDriversBS.find(sDriverFactoryName ) == m_aDriversBS.end() )
else
else
{
{
EnsureDriver
aEnsure
;
EnsureDriver
aEnsure
(
m_aContext
.
getUNOContext
()
)
;
aEnsure
(
*
aFind
);
aEnsure
(
*
aFind
);
}
}
...
...
connectivity/source/manager/mdrivermanager.hxx
Dosyayı görüntüle @
7f635eeb
...
@@ -50,12 +50,10 @@ namespace drivermanager
...
@@ -50,12 +50,10 @@ namespace drivermanager
DECLARE_STL_USTRINGACCESS_MAP
(
SdbcDriver
,
DriverCollection
);
DECLARE_STL_USTRINGACCESS_MAP
(
SdbcDriver
,
DriverCollection
);
typedef
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XSingleComponentFactory
>
DriverFactory
;
typedef
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
lang
::
XSingleComponentFactory
>
DriverFactory
;
typedef
::
com
::
sun
::
star
::
uno
::
Reference
<
::
com
::
sun
::
star
::
uno
::
XComponentContext
>
UNOContext
;
struct
DriverAccess
struct
DriverAccess
{
{
::
rtl
::
OUString
sImplementationName
;
/// the implementation name of the driver
::
rtl
::
OUString
sImplementationName
;
/// the implementation name of the driver
DriverFactory
xComponentFactory
;
/// the factory to create the driver component (if not already done so)
DriverFactory
xComponentFactory
;
/// the factory to create the driver component (if not already done so)
UNOContext
xUNOContext
;
/// ensure UNO context propagation
SdbcDriver
xDriver
;
/// the driver itself
SdbcDriver
xDriver
;
/// the driver itself
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment