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 #ifndef DBACCESS_MODULE_SDBT_HXX
28 #include "module_sdbt.hxx"
29 #endif
30
31 /** === begin UNO using === **/
32 using ::com::sun::star::lang::XMultiServiceFactory;
33 using ::com::sun::star::registry::XRegistryKey;
34 using ::com::sun::star::registry::InvalidRegistryException;
35 using ::com::sun::star::uno::Reference;
36 using ::com::sun::star::uno::XInterface;
37 /** === end UNO using === **/
38
39 extern "C" void SAL_CALL createRegistryInfo_ConnectionTools();
40
41 //---------------------------------------------------------------------------------------
42
sdbt_initializeModule()43 extern "C" void SAL_CALL sdbt_initializeModule()
44 {
45 static sal_Bool s_bInit = sal_False;
46 if (!s_bInit)
47 {
48 createRegistryInfo_ConnectionTools();
49 s_bInit = sal_True;
50 }
51 }
52
53 //---------------------------------------------------------------------------------------
54
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)55 extern "C" SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
56 const sal_Char **ppEnvTypeName,
57 uno_Environment **
58 )
59 {
60 sdbt_initializeModule();
61 *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
62 }
63
64 //---------------------------------------------------------------------------------------
component_getFactory(const sal_Char * pImplementationName,void * pServiceManager,void *)65 extern "C" SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory(
66 const sal_Char* pImplementationName,
67 void* pServiceManager,
68 void* /*pRegistryKey*/)
69 {
70 Reference< XInterface > xRet;
71 if (pServiceManager && pImplementationName)
72 {
73 xRet = ::sdbtools::SdbtModule::getInstance().getComponentFactory(
74 ::rtl::OUString::createFromAscii(pImplementationName),
75 static_cast< XMultiServiceFactory* >(pServiceManager));
76 }
77
78 if (xRet.is())
79 xRet->acquire();
80 return xRet.get();
81 };
82
83