24#include <com/sun/star/sdb/SQLContext.hpp>
25#include <com/sun/star/lang/NullPointerException.hpp>
26#include <com/sun/star/frame/Desktop.hpp>
47 aError.Message = _rMessage;
48 aError.SQLState =
"S1000";
55void throwNoMacOSException()
70MacabImplModule::MacabImplModule()
71 :m_bAttemptedLoadModule(false)
72 ,m_hConnectorModule(nullptr)
73 ,m_pConnectionFactoryFunc(nullptr)
86 template<
typename FUNCTION >
87 void lcl_getFunctionFromModuleOrUnload( oslModule& _rModule,
const char* _pAsciiSymbolName, FUNCTION& _rFunction )
93 const OUString sSymbolName = OUString::createFromAscii( _pAsciiSymbolName );
94 _rFunction =
reinterpret_cast<FUNCTION>( osl_getSymbol( _rModule, sSymbolName.pData ) );
98 SAL_WARN(
"connectivity.macab",
"lcl_getFunctionFromModuleOrUnload: could not find the symbol " << _pAsciiSymbolName );
99 osl_unloadModule( _rModule );
116 "MacabImplModule::impl_loadModule: inconsistence: inconsistency (never attempted load before, but some values already set)!");
118 const OUString sModuleName( SAL_MODULENAME(
"macabdrv1" ) );
120 OSL_ENSURE(
m_hConnectorModule,
"MacabImplModule::impl_loadModule: could not load the implementation library!" );
128 throw RuntimeException();
136 OSL_PRECOND(
m_hConnectorModule !=
nullptr,
"MacabImplModule::impl_unloadModule: no module!" );
150 throwNoMacOSException();
157 OSL_PRECOND(
m_hConnectorModule,
"MacabImplModule::createConnection: not initialized!" );
159 void* pUntypedConnection = (*m_pConnectionFactoryFunc)( _pDriver );
160 if ( !pUntypedConnection )
161 throw RuntimeException();
185 throw NullPointerException();
191 xDesktop->addTerminateListener(
this );
218 return "com.sun.star.comp.sdbc.macab.Driver";
230 return {
"com.sun.star.sdbc.Driver" };
241 SAL_WARN_IF( !pConnection,
"connectivity.macab",
"MacabDriver::connect: no connection has been created by the factory!" );
245 pConnection->release();
264 return url ==
"sdbc:address:macab";
300 return "/org.openoffice.Office.DataAccess/DriverSettings/com.sun.star.comp.sdbc.macab.Driver";
303extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
305 css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any>
const&)
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * connectivity_MacabDriver_get_implementation(css::uno::XComponentContext *context, css::uno::Sequence< css::uno::Any > const &)
#define MACAB_DRIVER_VERSION_MINOR
#define MACAB_DRIVER_VERSION_MAJOR
Reference< XComponentContext > m_xContext
virtual void disposing(std::unique_lock< std::mutex > &)
helper class for accessing resources shared by different libraries in the connectivity module
OUString getResourceString(TranslateId pResId) const
loads a string from the shared resource file
virtual void construct(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info)
virtual void SAL_CALL queryTermination(const css::lang::EventObject &Event) override
OWeakRefArray m_xConnections
virtual void SAL_CALL disposing() override
virtual OUString SAL_CALL getImplementationName() override
virtual css::uno::Reference< css::sdbc::XConnection > SAL_CALL connect(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
MacabDriver(const css::uno::Reference< css::uno::XComponentContext > &_rxContext)
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual void SAL_CALL notifyTermination(const css::lang::EventObject &Event) override
static OUString impl_getConfigurationSettingsPath()
returns the path of our configuration settings
virtual sal_Bool SAL_CALL acceptsURL(const OUString &url) override
MacabImplModule m_aImplModule
virtual sal_Int32 SAL_CALL getMinorVersion() override
css::uno::Reference< css::uno::XComponentContext > m_xContext
virtual css::uno::Sequence< css::sdbc::DriverPropertyInfo > SAL_CALL getPropertyInfo(const OUString &url, const css::uno::Sequence< css::beans::PropertyValue > &info) override
virtual sal_Int32 SAL_CALL getMajorVersion() override
bool impl_loadModule()
loads the implementation module and retrieves the needed symbols
bool m_bAttemptedLoadModule
Did we already attempt to load the module and to retrieve the symbols?
ConnectionFactoryFunction m_pConnectionFactoryFunc
MacabConnection * createConnection(MacabDriver *_pDriver) const
creates a new connection @precond <member>init</member> has been called before
void shutdown()
shuts down the impl module
void impl_unloadModule()
unloads the implementation module, and resets all function pointers to <NULL> @precond m_hConnectorMo...
void init()
initializes the implementation module.
oslModule m_hConnectorModule
bool isMacOSPresent()
determines whether there is a mac OS present in the environment
#define DBG_UNHANDLED_EXCEPTION(...)
#define SAL_WARN_IF(condition, area, stream)
#define SAL_WARN(area, stream)
::cppu::WeakComponentImplHelper< css::sdbc::XDriver, css::lang::XServiceInfo, css::frame::XTerminateListener > MacabDriver_BASE
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)