xref: /trunk/main/ucb/source/cacher/cacheserv.cxx (revision 1ecadb572e7010ff3b3382ad9bf179dbc6efadbb) !
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_ucb.hxx"
30 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
31 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
32 #include <com/sun/star/registry/XRegistryKey.hpp>
33 #include <cachedcontentresultset.hxx>
34 #include <cachedcontentresultsetstub.hxx>
35 #include <cacheddynamicresultset.hxx>
36 #include <cacheddynamicresultsetstub.hxx>
37 
38 using namespace rtl;
39 using namespace com::sun::star::uno;
40 using namespace com::sun::star::lang;
41 using namespace com::sun::star::registry;
42 
43 //=========================================================================
44 extern "C" void SAL_CALL component_getImplementationEnvironment(
45     const sal_Char ** ppEnvTypeName, uno_Environment ** )
46 {
47     *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
48 }
49 
50 //=========================================================================
51 extern "C" void * SAL_CALL component_getFactory(
52     const sal_Char * pImplName, void * pServiceManager, void * )
53 {
54     void * pRet = 0;
55 
56     Reference< XMultiServiceFactory > xSMgr(
57             reinterpret_cast< XMultiServiceFactory * >( pServiceManager ) );
58     Reference< XSingleServiceFactory > xFactory;
59 
60     //////////////////////////////////////////////////////////////////////
61     // CachedContentResultSetFactory.
62     //////////////////////////////////////////////////////////////////////
63 
64     if ( CachedContentResultSetFactory::getImplementationName_Static().
65                 compareToAscii( pImplName ) == 0 )
66     {
67         xFactory = CachedContentResultSetFactory::createServiceFactory( xSMgr );
68     }
69 
70     //////////////////////////////////////////////////////////////////////
71     // CachedContentResultSetStubFactory.
72     //////////////////////////////////////////////////////////////////////
73 
74     else if ( CachedContentResultSetStubFactory::getImplementationName_Static().
75                 compareToAscii( pImplName ) == 0 )
76     {
77         xFactory = CachedContentResultSetStubFactory::createServiceFactory( xSMgr );
78     }
79 
80     //////////////////////////////////////////////////////////////////////
81     // CachedDynamicResultSetFactory.
82     //////////////////////////////////////////////////////////////////////
83 
84     else if ( CachedDynamicResultSetFactory::getImplementationName_Static().
85                 compareToAscii( pImplName ) == 0 )
86     {
87         xFactory = CachedDynamicResultSetFactory::createServiceFactory( xSMgr );
88     }
89 
90     //////////////////////////////////////////////////////////////////////
91     // CachedDynamicResultSetStubFactory.
92     //////////////////////////////////////////////////////////////////////
93 
94     else if ( CachedDynamicResultSetStubFactory::getImplementationName_Static().
95                 compareToAscii( pImplName ) == 0 )
96     {
97         xFactory = CachedDynamicResultSetStubFactory::createServiceFactory( xSMgr );
98     }
99 
100     //////////////////////////////////////////////////////////////////////
101 
102     if ( xFactory.is() )
103     {
104         xFactory->acquire();
105         pRet = xFactory.get();
106     }
107 
108     return pRet;
109 }
110 
111