xref: /aoo42x/main/ure/source/uretest/JavaMain.java (revision 87e37ca8)
1*87e37ca8SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*87e37ca8SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*87e37ca8SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*87e37ca8SAndrew Rist  * distributed with this work for additional information
6*87e37ca8SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*87e37ca8SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*87e37ca8SAndrew Rist  * "License"); you may not use this file except in compliance
9*87e37ca8SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*87e37ca8SAndrew Rist  *
11*87e37ca8SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*87e37ca8SAndrew Rist  *
13*87e37ca8SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*87e37ca8SAndrew Rist  * software distributed under the License is distributed on an
15*87e37ca8SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*87e37ca8SAndrew Rist  * KIND, either express or implied.  See the License for the
17*87e37ca8SAndrew Rist  * specific language governing permissions and limitations
18*87e37ca8SAndrew Rist  * under the License.
19*87e37ca8SAndrew Rist  *
20*87e37ca8SAndrew Rist  *************************************************************/
21*87e37ca8SAndrew Rist 
22*87e37ca8SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package test.java.javamain;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import com.sun.star.comp.loader.FactoryHelper;
27cdf0e10cSrcweir import com.sun.star.lang.XMain;
28cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
29cdf0e10cSrcweir import com.sun.star.lang.XSingleServiceFactory;
30cdf0e10cSrcweir import com.sun.star.registry.XRegistryKey;
31cdf0e10cSrcweir import com.sun.star.uno.XComponentContext;
32cdf0e10cSrcweir import test.java.tester.Tester;
33cdf0e10cSrcweir 
34cdf0e10cSrcweir public final class JavaMain implements XMain {
JavaMain(XComponentContext context)35cdf0e10cSrcweir     public JavaMain(XComponentContext context) {
36cdf0e10cSrcweir         this.context = context;
37cdf0e10cSrcweir     }
38cdf0e10cSrcweir 
run(String[] arguments)39cdf0e10cSrcweir     public int run(String[] arguments) {
40cdf0e10cSrcweir         Tester.test(context);
41cdf0e10cSrcweir         return 0;
42cdf0e10cSrcweir     }
43cdf0e10cSrcweir 
__writeRegistryServiceInfo(XRegistryKey key)44cdf0e10cSrcweir     public static boolean __writeRegistryServiceInfo(XRegistryKey key) {
45cdf0e10cSrcweir         return
46cdf0e10cSrcweir             FactoryHelper.writeRegistryServiceInfo(
47cdf0e10cSrcweir                 IMPLEMENTATION_NAME, SERVICE_NAME, key);
48cdf0e10cSrcweir     }
49cdf0e10cSrcweir 
__getServiceFactory( String name, XMultiServiceFactory factory, XRegistryKey key)50cdf0e10cSrcweir     public static XSingleServiceFactory __getServiceFactory(
51cdf0e10cSrcweir         String name, XMultiServiceFactory factory, XRegistryKey key)
52cdf0e10cSrcweir     {
53cdf0e10cSrcweir         if (name.equals(IMPLEMENTATION_NAME)) {
54cdf0e10cSrcweir             return FactoryHelper.getServiceFactory(
55cdf0e10cSrcweir                 JavaMain.class, SERVICE_NAME, factory, key);
56cdf0e10cSrcweir         } else {
57cdf0e10cSrcweir             return null;
58cdf0e10cSrcweir         }
59cdf0e10cSrcweir     }
60cdf0e10cSrcweir 
61cdf0e10cSrcweir     private static final String IMPLEMENTATION_NAME
62cdf0e10cSrcweir     = "test.java.javamain.Component";
63cdf0e10cSrcweir     private static final String SERVICE_NAME = "test.dummy.JavaMain";
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     private final XComponentContext context;
66cdf0e10cSrcweir }
67