1*7c448b18SAndrew Rist /**************************************************************
2*7c448b18SAndrew Rist  *
3*7c448b18SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*7c448b18SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*7c448b18SAndrew Rist  * distributed with this work for additional information
6*7c448b18SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*7c448b18SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*7c448b18SAndrew Rist  * "License"); you may not use this file except in compliance
9*7c448b18SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*7c448b18SAndrew Rist  *
11*7c448b18SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*7c448b18SAndrew Rist  *
13*7c448b18SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*7c448b18SAndrew Rist  * software distributed under the License is distributed on an
15*7c448b18SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*7c448b18SAndrew Rist  * KIND, either express or implied.  See the License for the
17*7c448b18SAndrew Rist  * specific language governing permissions and limitations
18*7c448b18SAndrew Rist  * under the License.
19*7c448b18SAndrew Rist  *
20*7c448b18SAndrew Rist  *************************************************************/
21*7c448b18SAndrew Rist 
22*7c448b18SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package com.sun.star.comp.test.deployment.active_java;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import com.sun.star.lang.XSingleComponentFactory;
27cdf0e10cSrcweir import com.sun.star.lib.uno.helper.Factory;
28cdf0e10cSrcweir import com.sun.star.registry.InvalidRegistryException;
29cdf0e10cSrcweir import com.sun.star.registry.XRegistryKey;
30cdf0e10cSrcweir 
31cdf0e10cSrcweir public final class Services {
Services()32cdf0e10cSrcweir     private Services() {}
33cdf0e10cSrcweir 
__getComponentFactory( String implementation)34cdf0e10cSrcweir     public static XSingleComponentFactory __getComponentFactory(
35cdf0e10cSrcweir         String implementation)
36cdf0e10cSrcweir     {
37cdf0e10cSrcweir         if (implementation.equals(Dispatch.implementationName)) {
38cdf0e10cSrcweir             return Factory.createComponentFactory(
39cdf0e10cSrcweir                 Dispatch.class, Dispatch.implementationName,
40cdf0e10cSrcweir                 Dispatch.serviceNames);
41cdf0e10cSrcweir         } else if (implementation.equals(Provider.implementationName)) {
42cdf0e10cSrcweir             return Factory.createComponentFactory(
43cdf0e10cSrcweir                 Provider.class, Provider.implementationName,
44cdf0e10cSrcweir                 Provider.serviceNames);
45cdf0e10cSrcweir         } else {
46cdf0e10cSrcweir             return null;
47cdf0e10cSrcweir         }
48cdf0e10cSrcweir     }
49cdf0e10cSrcweir 
__writeRegistryServiceInfo(XRegistryKey key)50cdf0e10cSrcweir     public static boolean __writeRegistryServiceInfo(XRegistryKey key) {
51cdf0e10cSrcweir         if (!(Factory.writeRegistryServiceInfo(
52cdf0e10cSrcweir                   Dispatch.implementationName, Dispatch.serviceNames, key) &&
53cdf0e10cSrcweir               Factory.writeRegistryServiceInfo(
54cdf0e10cSrcweir                   Provider.implementationName, Provider.serviceNames, key)))
55cdf0e10cSrcweir         {
56cdf0e10cSrcweir             return false;
57cdf0e10cSrcweir         }
58cdf0e10cSrcweir         try {
59cdf0e10cSrcweir             key.
60cdf0e10cSrcweir                 createKey(
61cdf0e10cSrcweir                     "/" + Dispatch.implementationName +
62cdf0e10cSrcweir                     "/UNO/SINGLETONS/" +
63cdf0e10cSrcweir                     "com.sun.star.test.deployment.active_java_singleton").
64cdf0e10cSrcweir                 setStringValue(Dispatch.implementationName);
65cdf0e10cSrcweir         } catch (InvalidRegistryException e) {
66cdf0e10cSrcweir             return false;
67cdf0e10cSrcweir         }
68cdf0e10cSrcweir         return true;
69cdf0e10cSrcweir     }
70cdf0e10cSrcweir }
71