xref: /aoo42x/main/ure/source/uretest/JavaMain.java (revision 87e37ca8)
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 package test.java.javamain;
25 
26 import com.sun.star.comp.loader.FactoryHelper;
27 import com.sun.star.lang.XMain;
28 import com.sun.star.lang.XMultiServiceFactory;
29 import com.sun.star.lang.XSingleServiceFactory;
30 import com.sun.star.registry.XRegistryKey;
31 import com.sun.star.uno.XComponentContext;
32 import test.java.tester.Tester;
33 
34 public final class JavaMain implements XMain {
JavaMain(XComponentContext context)35     public JavaMain(XComponentContext context) {
36         this.context = context;
37     }
38 
run(String[] arguments)39     public int run(String[] arguments) {
40         Tester.test(context);
41         return 0;
42     }
43 
__writeRegistryServiceInfo(XRegistryKey key)44     public static boolean __writeRegistryServiceInfo(XRegistryKey key) {
45         return
46             FactoryHelper.writeRegistryServiceInfo(
47                 IMPLEMENTATION_NAME, SERVICE_NAME, key);
48     }
49 
__getServiceFactory( String name, XMultiServiceFactory factory, XRegistryKey key)50     public static XSingleServiceFactory __getServiceFactory(
51         String name, XMultiServiceFactory factory, XRegistryKey key)
52     {
53         if (name.equals(IMPLEMENTATION_NAME)) {
54             return FactoryHelper.getServiceFactory(
55                 JavaMain.class, SERVICE_NAME, factory, key);
56         } else {
57             return null;
58         }
59     }
60 
61     private static final String IMPLEMENTATION_NAME
62     = "test.java.javamain.Component";
63     private static final String SERVICE_NAME = "test.dummy.JavaMain";
64 
65     private final XComponentContext context;
66 }
67