xref: /aoo42x/main/ucb/source/cacher/cacheserv.cxx (revision 2f86921c)
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_ucb.hxx"
26 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
27 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
28 #include <com/sun/star/registry/XRegistryKey.hpp>
29 #include <cachedcontentresultset.hxx>
30 #include <cachedcontentresultsetstub.hxx>
31 #include <cacheddynamicresultset.hxx>
32 #include <cacheddynamicresultsetstub.hxx>
33 
34 using namespace rtl;
35 using namespace com::sun::star::uno;
36 using namespace com::sun::star::lang;
37 using namespace com::sun::star::registry;
38 
39 //=========================================================================
40 extern "C" void SAL_CALL component_getImplementationEnvironment(
41 	const sal_Char ** ppEnvTypeName, uno_Environment ** )
42 {
43 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
44 }
45 
46 //=========================================================================
47 extern "C" void * SAL_CALL component_getFactory(
48 	const sal_Char * pImplName, void * pServiceManager, void * )
49 {
50 	void * pRet = 0;
51 
52 	Reference< XMultiServiceFactory > xSMgr(
53 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
54 	Reference< XSingleServiceFactory > xFactory;
55 
56 	//////////////////////////////////////////////////////////////////////
57 	// CachedContentResultSetFactory.
58 	//////////////////////////////////////////////////////////////////////
59 
60 	if ( CachedContentResultSetFactory::getImplementationName_Static().
61 				compareToAscii( pImplName ) == 0 )
62 	{
63 		xFactory = CachedContentResultSetFactory::createServiceFactory( xSMgr );
64 	}
65 
66 	//////////////////////////////////////////////////////////////////////
67 	// CachedContentResultSetStubFactory.
68 	//////////////////////////////////////////////////////////////////////
69 
70 	else if ( CachedContentResultSetStubFactory::getImplementationName_Static().
71 				compareToAscii( pImplName ) == 0 )
72 	{
73 		xFactory = CachedContentResultSetStubFactory::createServiceFactory( xSMgr );
74 	}
75 
76 	//////////////////////////////////////////////////////////////////////
77 	// CachedDynamicResultSetFactory.
78 	//////////////////////////////////////////////////////////////////////
79 
80 	else if ( CachedDynamicResultSetFactory::getImplementationName_Static().
81 				compareToAscii( pImplName ) == 0 )
82 	{
83 		xFactory = CachedDynamicResultSetFactory::createServiceFactory( xSMgr );
84 	}
85 
86 	//////////////////////////////////////////////////////////////////////
87 	// CachedDynamicResultSetStubFactory.
88 	//////////////////////////////////////////////////////////////////////
89 
90 	else if ( CachedDynamicResultSetStubFactory::getImplementationName_Static().
91 				compareToAscii( pImplName ) == 0 )
92 	{
93 		xFactory = CachedDynamicResultSetStubFactory::createServiceFactory( xSMgr );
94 	}
95 
96 	//////////////////////////////////////////////////////////////////////
97 
98 	if ( xFactory.is() )
99 	{
100 		xFactory->acquire();
101 		pRet = xFactory.get();
102 	}
103 
104 	return pRet;
105 }
106 
107