2000-09-18 23:16:46 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 12:03:04 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 12:03:04 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 12:03:04 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 12:03:04 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 12:03:04 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
2008-04-10 12:03:04 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2000-09-18 23:16:46 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-17 05:43:03 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_dbaccess.hxx"
|
|
|
|
|
2008-03-05 16:06:41 +00:00
|
|
|
#include <cppuhelper/factory.hxx>
|
|
|
|
#include <cppuhelper/implementationentry.hxx>
|
2008-01-30 07:37:09 +00:00
|
|
|
#include "module_dba.hxx"
|
2000-09-18 23:16:46 +00:00
|
|
|
#include <osl/diagnose.h>
|
2008-03-05 16:06:41 +00:00
|
|
|
#include "DatabaseDataProvider.hxx"
|
2008-12-30 13:32:01 +00:00
|
|
|
#include "dbadllapi.hxx"
|
2000-09-18 23:16:46 +00:00
|
|
|
|
|
|
|
/********************************************************************************************/
|
|
|
|
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::registry;
|
|
|
|
|
|
|
|
//***************************************************************************************
|
|
|
|
//
|
|
|
|
// registry functions
|
|
|
|
extern "C" void SAL_CALL createRegistryInfo_ODatabaseContext();
|
|
|
|
extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition();
|
2004-08-02 14:16:43 +00:00
|
|
|
extern "C" void SAL_CALL createRegistryInfo_OComponentDefinition();
|
2000-09-18 23:16:46 +00:00
|
|
|
extern "C" void SAL_CALL createRegistryInfo_ORowSet();
|
2005-03-10 15:38:14 +00:00
|
|
|
extern "C" void SAL_CALL createRegistryInfo_ODatabaseDocument();
|
|
|
|
extern "C" void SAL_CALL createRegistryInfo_ODatabaseSource();
|
2008-01-30 07:37:09 +00:00
|
|
|
extern "C" void SAL_CALL createRegistryInfo_DataAccessDescriptorFactory();
|
2000-09-18 23:16:46 +00:00
|
|
|
|
2008-10-01 12:28:29 +00:00
|
|
|
namespace dba{
|
2008-03-05 16:06:41 +00:00
|
|
|
//--------------------------------------------------------------------------
|
|
|
|
::cppu::ImplementationEntry entries[] = {
|
|
|
|
{ &::dbaccess::DatabaseDataProvider::Create, &::dbaccess::DatabaseDataProvider::getImplementationName_Static, &::dbaccess::DatabaseDataProvider::getSupportedServiceNames_Static,
|
|
|
|
&cppu::createSingleComponentFactory, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0 }
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2000-09-18 23:16:46 +00:00
|
|
|
//***************************************************************************************
|
|
|
|
//
|
|
|
|
// Die vorgeschriebene C-Api muss erfuellt werden!
|
|
|
|
// Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen.
|
|
|
|
//
|
2000-12-15 15:46:23 +00:00
|
|
|
extern "C" void SAL_CALL createRegistryInfo_DBA()
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
static sal_Bool bInit = sal_False;
|
|
|
|
if (!bInit)
|
|
|
|
{
|
|
|
|
createRegistryInfo_ODatabaseContext();
|
|
|
|
createRegistryInfo_OCommandDefinition();
|
2004-08-02 14:16:43 +00:00
|
|
|
createRegistryInfo_OComponentDefinition();
|
2000-09-18 23:16:46 +00:00
|
|
|
createRegistryInfo_ORowSet();
|
2005-03-10 15:38:14 +00:00
|
|
|
createRegistryInfo_ODatabaseDocument();
|
|
|
|
createRegistryInfo_ODatabaseSource();
|
2008-01-30 07:37:09 +00:00
|
|
|
createRegistryInfo_DataAccessDescriptorFactory();
|
2000-09-18 23:16:46 +00:00
|
|
|
bInit = sal_True;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
|
|
|
2008-12-30 13:32:01 +00:00
|
|
|
extern "C" OOO_DLLPUBLIC_DBA void SAL_CALL component_getImplementationEnvironment(
|
2000-09-18 23:16:46 +00:00
|
|
|
const sal_Char **ppEnvTypeName,
|
2006-10-12 12:32:41 +00:00
|
|
|
uno_Environment **
|
2000-09-18 23:16:46 +00:00
|
|
|
)
|
|
|
|
{
|
2000-12-15 15:46:23 +00:00
|
|
|
createRegistryInfo_DBA();
|
2000-09-18 23:16:46 +00:00
|
|
|
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------
|
2008-12-30 13:32:01 +00:00
|
|
|
extern "C" OOO_DLLPUBLIC_DBA sal_Bool SAL_CALL component_writeInfo(
|
2000-09-18 23:16:46 +00:00
|
|
|
void* pServiceManager,
|
|
|
|
void* pRegistryKey
|
|
|
|
)
|
|
|
|
{
|
|
|
|
if (pRegistryKey)
|
|
|
|
try
|
|
|
|
{
|
2008-01-30 07:37:09 +00:00
|
|
|
return ::dba::DbaModule::getInstance().writeComponentInfos(
|
|
|
|
static_cast< XMultiServiceFactory* >( pServiceManager ),
|
2008-03-05 16:06:41 +00:00
|
|
|
static_cast< XRegistryKey* >( pRegistryKey ) )
|
2008-10-01 12:28:29 +00:00
|
|
|
&& cppu::component_writeInfoHelper(pServiceManager, pRegistryKey, dba::entries);
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
catch (InvalidRegistryException& )
|
|
|
|
{
|
2008-01-30 07:37:09 +00:00
|
|
|
OSL_ENSURE( false, "DBA::component_writeInfo : could not create a registry key ! ## InvalidRegistryException !" );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------------------
|
2008-12-30 13:32:01 +00:00
|
|
|
extern "C" OOO_DLLPUBLIC_DBA void* SAL_CALL component_getFactory(
|
2000-09-18 23:16:46 +00:00
|
|
|
const sal_Char* pImplementationName,
|
|
|
|
void* pServiceManager,
|
2008-03-05 16:06:41 +00:00
|
|
|
void* pRegistryKey)
|
2000-09-18 23:16:46 +00:00
|
|
|
{
|
|
|
|
Reference< XInterface > xRet;
|
|
|
|
if (pServiceManager && pImplementationName)
|
|
|
|
{
|
2008-01-30 07:37:09 +00:00
|
|
|
xRet = ::dba::DbaModule::getInstance().getComponentFactory(
|
|
|
|
::rtl::OUString::createFromAscii( pImplementationName ),
|
|
|
|
static_cast< XMultiServiceFactory* >( pServiceManager ) );
|
2000-09-18 23:16:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (xRet.is())
|
|
|
|
xRet->acquire();
|
2008-03-05 16:06:41 +00:00
|
|
|
else
|
|
|
|
return cppu::component_getFactoryHelper(
|
2008-10-01 12:28:29 +00:00
|
|
|
pImplementationName, pServiceManager, pRegistryKey, dba::entries);
|
2000-09-18 23:16:46 +00:00
|
|
|
return xRet.get();
|
|
|
|
};
|