1*06b3ce53SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*06b3ce53SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*06b3ce53SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*06b3ce53SAndrew Rist  * distributed with this work for additional information
6*06b3ce53SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*06b3ce53SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*06b3ce53SAndrew Rist  * "License"); you may not use this file except in compliance
9*06b3ce53SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*06b3ce53SAndrew Rist  *
11*06b3ce53SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*06b3ce53SAndrew Rist  *
13*06b3ce53SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*06b3ce53SAndrew Rist  * software distributed under the License is distributed on an
15*06b3ce53SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*06b3ce53SAndrew Rist  * KIND, either express or implied.  See the License for the
17*06b3ce53SAndrew Rist  * specific language governing permissions and limitations
18*06b3ce53SAndrew Rist  * under the License.
19*06b3ce53SAndrew Rist  *
20*06b3ce53SAndrew Rist  *************************************************************/
21*06b3ce53SAndrew Rist 
22*06b3ce53SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_xmlsecurity.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <stdio.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <osl/mutex.hxx>
30cdf0e10cSrcweir #include <osl/thread.h>
31cdf0e10cSrcweir #include <cppuhelper/factory.hxx>
32cdf0e10cSrcweir #include <com/sun/star/lang/XSingleServiceFactory.hpp>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <decryptorimpl.hxx>
35cdf0e10cSrcweir #include <encryptorimpl.hxx>
36cdf0e10cSrcweir #include <signaturecreatorimpl.hxx>
37cdf0e10cSrcweir #include <signatureverifierimpl.hxx>
38cdf0e10cSrcweir #include <saxeventkeeperimpl.hxx>
39cdf0e10cSrcweir #include <xmlencryptiontemplateimpl.hxx>
40cdf0e10cSrcweir #include <xmlsignaturetemplateimpl.hxx>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir using namespace ::rtl;
43cdf0e10cSrcweir using namespace ::cppu;
44cdf0e10cSrcweir using namespace ::com::sun::star::uno;
45cdf0e10cSrcweir using namespace ::com::sun::star::lang;
46cdf0e10cSrcweir using namespace ::com::sun::star::registry;
47cdf0e10cSrcweir 
48cdf0e10cSrcweir extern "C"
49cdf0e10cSrcweir {
50cdf0e10cSrcweir //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)51cdf0e10cSrcweir void SAL_CALL component_getImplementationEnvironment(
52cdf0e10cSrcweir 	const sal_Char ** ppEnvTypeName, uno_Environment **)
53cdf0e10cSrcweir {
54cdf0e10cSrcweir 	*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
55cdf0e10cSrcweir }
56cdf0e10cSrcweir 
57cdf0e10cSrcweir //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)58cdf0e10cSrcweir void * SAL_CALL component_getFactory(
59cdf0e10cSrcweir 	const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
60cdf0e10cSrcweir {
61cdf0e10cSrcweir 	void * pRet = 0;
62cdf0e10cSrcweir 
63cdf0e10cSrcweir 	//Decryptor
64cdf0e10cSrcweir 	OUString implName = OUString::createFromAscii( pImplName );
65cdf0e10cSrcweir 	if ( pServiceManager && implName.equals(DecryptorImpl_getImplementationName()) )
66cdf0e10cSrcweir 	{
67cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
68cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
69cdf0e10cSrcweir 			OUString::createFromAscii( pImplName ),
70cdf0e10cSrcweir 			DecryptorImpl_createInstance, DecryptorImpl_getSupportedServiceNames() ) );
71cdf0e10cSrcweir 
72cdf0e10cSrcweir 		if (xFactory.is())
73cdf0e10cSrcweir 		{
74cdf0e10cSrcweir 			xFactory->acquire();
75cdf0e10cSrcweir 			pRet = xFactory.get();
76cdf0e10cSrcweir 		}
77cdf0e10cSrcweir 	}
78cdf0e10cSrcweir 
79cdf0e10cSrcweir 	//Encryptor
80cdf0e10cSrcweir 	if ( pServiceManager && implName.equals(EncryptorImpl_getImplementationName()) )
81cdf0e10cSrcweir 	{
82cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
83cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
84cdf0e10cSrcweir 			OUString::createFromAscii( pImplName ),
85cdf0e10cSrcweir 			EncryptorImpl_createInstance, EncryptorImpl_getSupportedServiceNames() ) );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 		if (xFactory.is())
88cdf0e10cSrcweir 		{
89cdf0e10cSrcweir 			xFactory->acquire();
90cdf0e10cSrcweir 			pRet = xFactory.get();
91cdf0e10cSrcweir 		}
92cdf0e10cSrcweir 	}
93cdf0e10cSrcweir 
94cdf0e10cSrcweir 	//SignatureCreator
95cdf0e10cSrcweir 	if ( pServiceManager && implName.equals(SignatureCreatorImpl_getImplementationName()) )
96cdf0e10cSrcweir 	{
97cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
98cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
99cdf0e10cSrcweir 			OUString::createFromAscii( pImplName ),
100cdf0e10cSrcweir 			SignatureCreatorImpl_createInstance, SignatureCreatorImpl_getSupportedServiceNames() ) );
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 		if (xFactory.is())
103cdf0e10cSrcweir 		{
104cdf0e10cSrcweir 			xFactory->acquire();
105cdf0e10cSrcweir 			pRet = xFactory.get();
106cdf0e10cSrcweir 		}
107cdf0e10cSrcweir 	}
108cdf0e10cSrcweir 
109cdf0e10cSrcweir 	//SignatureVerifier
110cdf0e10cSrcweir 	if ( pServiceManager && implName.equals(SignatureVerifierImpl_getImplementationName()) )
111cdf0e10cSrcweir 	{
112cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
113cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
114cdf0e10cSrcweir 			OUString::createFromAscii( pImplName ),
115cdf0e10cSrcweir 			SignatureVerifierImpl_createInstance, SignatureVerifierImpl_getSupportedServiceNames() ) );
116cdf0e10cSrcweir 
117cdf0e10cSrcweir 		if (xFactory.is())
118cdf0e10cSrcweir 		{
119cdf0e10cSrcweir 			xFactory->acquire();
120cdf0e10cSrcweir 			pRet = xFactory.get();
121cdf0e10cSrcweir 		}
122cdf0e10cSrcweir 	}
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	//SAXEventKeeper
125cdf0e10cSrcweir 	if ( pServiceManager && implName.equals(SAXEventKeeperImpl_getImplementationName()) )
126cdf0e10cSrcweir 	{
127cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory( createSingleFactory(
128cdf0e10cSrcweir 			reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
129cdf0e10cSrcweir 			OUString::createFromAscii( pImplName ),
130cdf0e10cSrcweir 			SAXEventKeeperImpl_createInstance, SAXEventKeeperImpl_getSupportedServiceNames() ) );
131cdf0e10cSrcweir 
132cdf0e10cSrcweir 		if (xFactory.is())
133cdf0e10cSrcweir 		{
134cdf0e10cSrcweir 			xFactory->acquire();
135cdf0e10cSrcweir 			pRet = xFactory.get();
136cdf0e10cSrcweir 		}
137cdf0e10cSrcweir 	}
138cdf0e10cSrcweir 
139cdf0e10cSrcweir 	//XMLSignatureTemplate
140cdf0e10cSrcweir 	if ( pServiceManager && implName.equals( XMLSignatureTemplateImpl::impl_getImplementationName()) )
141cdf0e10cSrcweir 	{
142cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory = XMLSignatureTemplateImpl::impl_createFactory(
143cdf0e10cSrcweir 				reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 		if (xFactory.is())
146cdf0e10cSrcweir 		{
147cdf0e10cSrcweir 			xFactory->acquire();
148cdf0e10cSrcweir 			pRet = xFactory.get();
149cdf0e10cSrcweir 		}
150cdf0e10cSrcweir 	}
151cdf0e10cSrcweir 
152cdf0e10cSrcweir 	//XMLEncryptionTemplate
153cdf0e10cSrcweir 	if ( pServiceManager && implName.equals( XMLEncryptionTemplateImpl::impl_getImplementationName()) )
154cdf0e10cSrcweir 	{
155cdf0e10cSrcweir 		Reference< XSingleServiceFactory > xFactory = XMLEncryptionTemplateImpl::impl_createFactory(
156cdf0e10cSrcweir 				reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
157cdf0e10cSrcweir 
158cdf0e10cSrcweir 		if (xFactory.is())
159cdf0e10cSrcweir 		{
160cdf0e10cSrcweir 			xFactory->acquire();
161cdf0e10cSrcweir 			pRet = xFactory.get();
162cdf0e10cSrcweir 		}
163cdf0e10cSrcweir 	}
164cdf0e10cSrcweir 
165cdf0e10cSrcweir 	return pRet;
166cdf0e10cSrcweir }
167cdf0e10cSrcweir }
168cdf0e10cSrcweir 
169cdf0e10cSrcweir 
170