diff options
author | Ingrid Halama <iha@openoffice.org> | 2001-02-26 14:47:50 +0000 |
---|---|---|
committer | Ingrid Halama <iha@openoffice.org> | 2001-02-26 14:47:50 +0000 |
commit | f769306b7eaa48c99d5843bd386acafd7fc6e5fa (patch) | |
tree | 41982e15b56a2c84138982fbb59787c0a26c409a /ucb/source | |
parent | b0c8edcc230a24d6abbc7e1473233278efa55417 (diff) |
#84327#
Diffstat (limited to 'ucb/source')
-rw-r--r-- | ucb/source/cacher/cachedcontentresultset.cxx | 20 | ||||
-rw-r--r-- | ucb/source/cacher/cachedcontentresultsetstub.cxx | 8 | ||||
-rw-r--r-- | ucb/source/cacher/contentresultsetwrapper.cxx | 98 | ||||
-rw-r--r-- | ucb/source/cacher/contentresultsetwrapper.hxx | 14 |
4 files changed, 110 insertions, 30 deletions
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx index c3598b178a21..bead556b899c 100644 --- a/ucb/source/cacher/cachedcontentresultset.cxx +++ b/ucb/source/cacher/cachedcontentresultset.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cachedcontentresultset.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: sb $ $Date: 2001-02-08 14:04:28 $ + * last change: $Author: iha $ $Date: 2001-02-26 15:47:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -137,6 +137,7 @@ if( !m_aCache.hasRow( nRow ) ) \ m_bLastReadWasFromCache = sal_False; \ aGuard.clear(); \ applyPositionToOrigin( nRow ); \ + impl_init_xRowOrigin(); \ return m_xRowOrigin->getXXX( columnIndex ); \ } \ } \ @@ -1115,11 +1116,14 @@ void SAL_CALL CachedContentResultSet } else { - osl::Guard< osl::Mutex > aGuard( m_aMutex ); - if( !m_xPropertySetOrigin.is() ) + impl_init_xPropertySetOrigin(); { - OSL_ENSURE( sal_False, "broadcaster was disposed already" ); - return; + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + if( !m_xPropertySetOrigin.is() ) + { + OSL_ENSURE( sal_False, "broadcaster was disposed already" ); + return; + } } m_xPropertySetOrigin->setPropertyValue( aPropertyName, aValue ); } @@ -1171,6 +1175,7 @@ Any SAL_CALL CachedContentResultSet } else { + impl_init_xPropertySetOrigin(); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); if( !m_xPropertySetOrigin.is() ) @@ -1945,7 +1950,7 @@ sal_Bool SAL_CALL CachedContentResultSet RuntimeException ) { impl_EnsureNotDisposed(); - + impl_init_xRowOrigin(); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); if( m_bLastReadWasFromCache ) @@ -2121,6 +2126,7 @@ Any SAL_CALL CachedContentResultSet m_bLastReadWasFromCache = sal_False; aGuard.clear(); applyPositionToOrigin( nRow ); + impl_init_xRowOrigin(); return m_xRowOrigin->getObject( columnIndex, typeMap ); } } diff --git a/ucb/source/cacher/cachedcontentresultsetstub.cxx b/ucb/source/cacher/cachedcontentresultsetstub.cxx index b37a49a5832c..e98bc168c6c0 100644 --- a/ucb/source/cacher/cachedcontentresultsetstub.cxx +++ b/ucb/source/cacher/cachedcontentresultsetstub.cxx @@ -2,9 +2,9 @@ * * $RCSfile: cachedcontentresultsetstub.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: kso $ $Date: 2000-10-31 10:37:35 $ + * last change: $Author: iha $ $Date: 2001-02-26 15:47:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -280,6 +280,7 @@ FetchResult SAL_CALL CachedContentResultSetStub , sal_Int32 nRowCount, sal_Bool bDirection ) throw( RuntimeException ) { + impl_init_xRowOrigin(); FETCH_XXX( impl_getCurrentRowContent, m_xRowOrigin ); } @@ -363,6 +364,7 @@ FetchResult SAL_CALL CachedContentResultSetStub , sal_Int32 nRowCount, sal_Bool bDirection ) throw( com::sun::star::uno::RuntimeException ) { + impl_init_xContentAccessOrigin(); FETCH_XXX( impl_getCurrentContentIdentifierString, m_xContentAccessOrigin ); } @@ -372,6 +374,7 @@ FetchResult SAL_CALL CachedContentResultSetStub , sal_Int32 nRowCount, sal_Bool bDirection ) throw( com::sun::star::uno::RuntimeException ) { + impl_init_xContentAccessOrigin(); FETCH_XXX( impl_getCurrentContentIdentifier, m_xContentAccessOrigin ); } @@ -381,6 +384,7 @@ FetchResult SAL_CALL CachedContentResultSetStub , sal_Int32 nRowCount, sal_Bool bDirection ) throw( com::sun::star::uno::RuntimeException ) { + impl_init_xContentAccessOrigin(); FETCH_XXX( impl_getCurrentContent, m_xContentAccessOrigin ); } diff --git a/ucb/source/cacher/contentresultsetwrapper.cxx b/ucb/source/cacher/contentresultsetwrapper.cxx index 3ae10ace8a39..7f89e3e88eb6 100644 --- a/ucb/source/cacher/contentresultsetwrapper.cxx +++ b/ucb/source/cacher/contentresultsetwrapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: contentresultsetwrapper.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: kso $ $Date: 2000-10-31 10:37:35 $ + * last change: $Author: iha $ $Date: 2001-02-26 15:47:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -127,17 +127,64 @@ ContentResultSetWrapper::ContentResultSetWrapper( OSL_ENSURE( m_xResultSetOrigin.is(), "XResultSet is required" ); - m_xRowOrigin = Reference< XRow >( m_xResultSetOrigin, UNO_QUERY ); - OSL_ENSURE( m_xRowOrigin.is(), "interface XRow is required" ); + //!! call impl_init() at the end of constructor of derived class +}; - m_xContentAccessOrigin = Reference< XContentAccess >( m_xResultSetOrigin, UNO_QUERY ); - OSL_ENSURE( m_xContentAccessOrigin.is(), "interface XContentAccess is required" ); - m_xPropertySetOrigin = Reference< XPropertySet >( m_xResultSetOrigin, UNO_QUERY ); - OSL_ENSURE( m_xPropertySetOrigin.is(), "interface XPropertySet is required" ); +void SAL_CALL ContentResultSetWrapper::impl_init_xRowOrigin() +{ + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + if(m_xRowOrigin.is()) + return; + } - //call impl_init() at the end of constructor of derived class -}; + Reference< XRow > xOrgig = + Reference< XRow >( m_xResultSetOrigin, UNO_QUERY ); + + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + m_xRowOrigin = xOrgig; + OSL_ENSURE( m_xRowOrigin.is(), "interface XRow is required" ); + } +} + +void SAL_CALL ContentResultSetWrapper::impl_init_xContentAccessOrigin() +{ + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + if(m_xContentAccessOrigin.is()) + return; + } + + Reference< XContentAccess > xOrgig = + Reference< XContentAccess >( m_xResultSetOrigin, UNO_QUERY ); + + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + m_xContentAccessOrigin = xOrgig; + OSL_ENSURE( m_xContentAccessOrigin.is(), "interface XContentAccess is required" ); + } +} + + +void SAL_CALL ContentResultSetWrapper::impl_init_xPropertySetOrigin() +{ + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + if( m_xPropertySetOrigin.is() ) + return; + } + + Reference< XPropertySet > xOrig = + Reference< XPropertySet >( m_xResultSetOrigin, UNO_QUERY ); + + { + osl::Guard< osl::Mutex > aGuard( m_aMutex ); + m_xPropertySetOrigin = xOrig; + OSL_ENSURE( m_xPropertySetOrigin.is(), "interface XPropertySet is required" ); + } +} void SAL_CALL ContentResultSetWrapper::impl_init() { @@ -175,6 +222,7 @@ void SAL_CALL ContentResultSetWrapper if( m_xPropertySetInfo.is() ) return; + impl_init_xPropertySetOrigin(); if( !m_xPropertySetOrigin.is() ) return; } @@ -329,6 +377,7 @@ sal_Bool SAL_CALL ContentResultSetWrapper rtl::OUString aName = OUString::createFromAscii( "ResultSetType" ); //find out, if we are ForwardOnly and cache the value: + impl_init_xPropertySetOrigin(); if( !m_xPropertySetOrigin.is() ) { OSL_ENSURE( sal_False, "broadcaster was disposed already" ); @@ -546,7 +595,7 @@ void SAL_CALL ContentResultSetWrapper RuntimeException ) { impl_EnsureNotDisposed(); - + impl_init_xPropertySetOrigin(); if( !m_xPropertySetOrigin.is() ) { OSL_ENSURE( sal_False, "broadcaster was disposed already" ); @@ -564,7 +613,7 @@ Any SAL_CALL ContentResultSetWrapper RuntimeException ) { impl_EnsureNotDisposed(); - + impl_init_xPropertySetOrigin(); if( !m_xPropertySetOrigin.is() ) { OSL_ENSURE( sal_False, "broadcaster was disposed already" ); @@ -603,6 +652,7 @@ void SAL_CALL ContentResultSetWrapper m_pPropertyChangeListeners->addInterface( aPropertyName, xListener ); if( bNeedRegister ) { + impl_init_xPropertySetOrigin(); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); if( !m_xPropertySetOrigin.is() ) @@ -653,6 +703,7 @@ void SAL_CALL ContentResultSetWrapper m_pVetoableChangeListeners->addInterface( rPropertyName, xListener ); if( bNeedRegister ) { + impl_init_xPropertySetOrigin(); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); if( !m_xPropertySetOrigin.is() ) @@ -712,6 +763,7 @@ void SAL_CALL ContentResultSetWrapper if( !m_pPropertyChangeListeners->getContainedTypes().getLength() ) { + impl_init_xPropertySetOrigin(); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); if( !m_xPropertySetOrigin.is() ) @@ -770,6 +822,7 @@ void SAL_CALL ContentResultSetWrapper if( !m_pVetoableChangeListeners->getContainedTypes().getLength() ) { + impl_init_xPropertySetOrigin(); { osl::Guard< osl::Mutex > aGuard( m_aMutex ); if( !m_xPropertySetOrigin.is() ) @@ -808,11 +861,15 @@ void SAL_CALL ContentResultSetWrapper //release all references to the broadcaster: m_xResultSetOrigin.clear(); - m_xRowOrigin.clear(); - m_xContentAccessOrigin.clear(); - m_xPropertySetOrigin.clear(); + if(m_xRowOrigin.is()) + m_xRowOrigin.clear(); + if(m_xContentAccessOrigin.is()) + m_xContentAccessOrigin.clear(); + if(m_xPropertySetOrigin.is()) + m_xPropertySetOrigin.clear(); m_xMetaDataFromOrigin.clear(); - m_xPropertySetInfo.clear(); + if(m_xPropertySetInfo.is()) + m_xPropertySetInfo.clear(); } //virtual @@ -853,7 +910,7 @@ OUString SAL_CALL ContentResultSetWrapper throw( RuntimeException ) { impl_EnsureNotDisposed(); - + impl_init_xContentAccessOrigin(); if( !m_xContentAccessOrigin.is() ) { OSL_ENSURE( sal_False, "broadcaster was disposed already" ); @@ -869,7 +926,7 @@ Reference< XContentIdentifier > SAL_CALL ContentResultSetWrapper throw( RuntimeException ) { impl_EnsureNotDisposed(); - + impl_init_xContentAccessOrigin(); if( !m_xContentAccessOrigin.is() ) { OSL_ENSURE( sal_False, "broadcaster was disposed already" ); @@ -885,7 +942,7 @@ Reference< XContent > SAL_CALL ContentResultSetWrapper throw( RuntimeException ) { impl_EnsureNotDisposed(); - + impl_init_xContentAccessOrigin(); if( !m_xContentAccessOrigin.is() ) { OSL_ENSURE( sal_False, "broadcaster was disposed already" ); @@ -1188,6 +1245,7 @@ Reference< XInterface > SAL_CALL ContentResultSetWrapper #define XROW_GETXXX( getXXX ) \ impl_EnsureNotDisposed(); \ +impl_init_xRowOrigin(); \ if( !m_xRowOrigin.is() ) \ { \ OSL_ENSURE( sal_False, "broadcaster was disposed already" );\ @@ -1202,6 +1260,7 @@ sal_Bool SAL_CALL ContentResultSetWrapper RuntimeException ) { impl_EnsureNotDisposed(); + impl_init_xRowOrigin(); if( !m_xRowOrigin.is() ) { OSL_ENSURE( sal_False, "broadcaster was disposed already" ); @@ -1350,6 +1409,7 @@ Any SAL_CALL ContentResultSetWrapper //define XROW_GETXXX, where this is similar implemented impl_EnsureNotDisposed(); + impl_init_xRowOrigin(); if( !m_xRowOrigin.is() ) { OSL_ENSURE( sal_False, "broadcaster was disposed already" ); diff --git a/ucb/source/cacher/contentresultsetwrapper.hxx b/ucb/source/cacher/contentresultsetwrapper.hxx index b3a9a811fe1d..b222d9b629bd 100644 --- a/ucb/source/cacher/contentresultsetwrapper.hxx +++ b/ucb/source/cacher/contentresultsetwrapper.hxx @@ -2,9 +2,9 @@ * * $RCSfile: contentresultsetwrapper.hxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: kso $ $Date: 2000-10-31 10:37:35 $ + * last change: $Author: iha $ $Date: 2001-02-26 15:47:50 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -208,13 +208,17 @@ protected: m_xResultSetOrigin; com::sun::star::uno::Reference< com::sun::star::sdbc::XRow > m_xRowOrigin; //XRow-interface from m_xOrigin + //!! call impl_init_xRowOrigin() bevor you access this member com::sun::star::uno::Reference< com::sun::star::ucb::XContentAccess > m_xContentAccessOrigin; //XContentAccess-interface from m_xOrigin + //!! call impl_init_xContentAccessOrigin() bevor you access this member com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > m_xPropertySetOrigin; //XPropertySet-interface from m_xOrigin + //!! call impl_init_xPropertySetOrigin() bevor you access this member com::sun::star::uno::Reference< com::sun::star::beans::XPropertySetInfo > m_xPropertySetInfo; + //call impl_initPropertySetInfo() bevor you access this member sal_Int32 m_nForwardOnly; @@ -260,6 +264,12 @@ protected: //-- + void SAL_CALL impl_init_xRowOrigin(); + void SAL_CALL impl_init_xContentAccessOrigin(); + void SAL_CALL impl_init_xPropertySetOrigin(); + + //-- + virtual void SAL_CALL impl_initPropertySetInfo(); //helping XPropertySet void SAL_CALL |