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 import com.sun.star.lang.XMultiServiceFactory;
25 import com.sun.star.lang.XSingleServiceFactory;
26 import com.sun.star.registry.XRegistryKey;
27 import com.sun.star.lang.XTypeProvider;
28 import com.sun.star.lang.XServiceInfo;
29 import com.sun.star.comp.loader.FactoryHelper;
30 
31 public class TestServiceProvider
32 {
__getServiceFactory( String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey)33     public static XSingleServiceFactory __getServiceFactory(
34                                                 String implName,
35                                                 XMultiServiceFactory multiFactory,
36                                                 XRegistryKey regKey) {
37         XSingleServiceFactory xSingleServiceFactory = null;
38 
39         if (implName.equals( TestComponentA.class.getName()) )
40             xSingleServiceFactory = FactoryHelper.getServiceFactory(
41                 TestComponentA.class, TestComponentA.__serviceName,
42                 multiFactory, regKey);
43         else if (implName.equals(TestComponentB.class.getName()))
44             xSingleServiceFactory= FactoryHelper.getServiceFactory(
45                 TestComponentB.class, TestComponentB.__serviceName,
46                 multiFactory, regKey);
47         return xSingleServiceFactory;
48     }
49 
50     // This method not longer necessary since OOo 3.4 where the component registration
51     // was changed to passive component registration. For more details see
52     // https://wiki.openoffice.org/wiki/Passive_Component_Registration
53 
54 //     public static boolean __writeRegistryServiceInfo(XRegistryKey regKey){
55 //         boolean bregA= FactoryHelper.writeRegistryServiceInfo(
56 //             TestComponentA.class.getName(),
57 //             TestComponentA.__serviceName, regKey);
58 //         boolean bregB= FactoryHelper.writeRegistryServiceInfo(
59 //             TestComponentB.class.getName(),
60 //             TestComponentB.__serviceName, regKey);
61 //         return bregA && bregB;
62 //     }
63 }
64 
65