1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_dbaccess.hxx" 26 27 #include <cppuhelper/factory.hxx> 28 #include <cppuhelper/implementationentry.hxx> 29 #include "module_dba.hxx" 30 #include <osl/diagnose.h> 31 #include "DatabaseDataProvider.hxx" 32 #include "dbadllapi.hxx" 33 34 /********************************************************************************************/ 35 36 using namespace ::com::sun::star::uno; 37 using namespace ::com::sun::star::lang; 38 using namespace ::com::sun::star::registry; 39 40 //*************************************************************************************** 41 // 42 // registry functions 43 extern "C" void SAL_CALL createRegistryInfo_ODatabaseContext(); 44 extern "C" void SAL_CALL createRegistryInfo_OCommandDefinition(); 45 extern "C" void SAL_CALL createRegistryInfo_OComponentDefinition(); 46 extern "C" void SAL_CALL createRegistryInfo_ORowSet(); 47 extern "C" void SAL_CALL createRegistryInfo_ODatabaseDocument(); 48 extern "C" void SAL_CALL createRegistryInfo_ODatabaseSource(); 49 extern "C" void SAL_CALL createRegistryInfo_DataAccessDescriptorFactory(); 50 51 namespace dba{ 52 //-------------------------------------------------------------------------- 53 ::cppu::ImplementationEntry entries[] = { 54 { &::dbaccess::DatabaseDataProvider::Create, &::dbaccess::DatabaseDataProvider::getImplementationName_Static, &::dbaccess::DatabaseDataProvider::getSupportedServiceNames_Static, 55 &cppu::createSingleComponentFactory, 0, 0 }, 56 { 0, 0, 0, 0, 0, 0 } 57 }; 58 } 59 60 //*************************************************************************************** 61 // 62 // Die vorgeschriebene C-Api muss erfuellt werden! 63 // Sie besteht aus drei Funktionen, die von dem Modul exportiert werden muessen. 64 // 65 extern "C" void SAL_CALL createRegistryInfo_DBA() 66 { 67 static sal_Bool bInit = sal_False; 68 if (!bInit) 69 { 70 createRegistryInfo_ODatabaseContext(); 71 createRegistryInfo_OCommandDefinition(); 72 createRegistryInfo_OComponentDefinition(); 73 createRegistryInfo_ORowSet(); 74 createRegistryInfo_ODatabaseDocument(); 75 createRegistryInfo_ODatabaseSource(); 76 createRegistryInfo_DataAccessDescriptorFactory(); 77 bInit = sal_True; 78 } 79 } 80 81 //--------------------------------------------------------------------------------------- 82 83 extern "C" OOO_DLLPUBLIC_DBA void SAL_CALL component_getImplementationEnvironment( 84 const sal_Char **ppEnvTypeName, 85 uno_Environment ** 86 ) 87 { 88 createRegistryInfo_DBA(); 89 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; 90 } 91 92 //--------------------------------------------------------------------------------------- 93 extern "C" OOO_DLLPUBLIC_DBA void* SAL_CALL component_getFactory( 94 const sal_Char* pImplementationName, 95 void* pServiceManager, 96 void* pRegistryKey) 97 { 98 Reference< XInterface > xRet; 99 if (pServiceManager && pImplementationName) 100 { 101 xRet = ::dba::DbaModule::getInstance().getComponentFactory( 102 ::rtl::OUString::createFromAscii( pImplementationName ), 103 static_cast< XMultiServiceFactory* >( pServiceManager ) ); 104 } 105 106 if (xRet.is()) 107 xRet->acquire(); 108 else 109 return cppu::component_getFactoryHelper( 110 pImplementationName, pServiceManager, pRegistryKey, dba::entries); 111 return xRet.get(); 112 }; 113