Commit | Line | Data |
---|---|---|
3f5430db MM |
1 | package net.mattmccutchen.addins; |
2 | ||
3 | import java.util.*; | |
4 | ||
5 | import net.mattmccutchen.measurements.*; | |
6 | ||
7 | import com.sun.star.comp.loader.*; | |
8 | import com.sun.star.lang.*; | |
9 | import com.sun.star.registry.*; | |
10 | ||
11 | public class ServiceHelper { | |
12 | public final String implementationName; | |
13 | public final List<String> serviceNames; | |
14 | ||
15 | public ServiceHelper(String implementationName, | |
16 | List<String> serviceNames) { | |
17 | this.implementationName = implementationName; | |
18 | this.serviceNames = serviceNames; | |
19 | } | |
20 | ||
21 | public String mainServiceName() { | |
22 | // First name is the main one | |
23 | return serviceNames.get(0); | |
24 | } | |
25 | ||
26 | public XSingleServiceFactory staticGetServiceFactory(String implName, | |
27 | XMultiServiceFactory multiFactory, XRegistryKey regKey) { | |
28 | if (implName.equals(implementationName)) | |
29 | return FactoryHelper.getServiceFactory(MeasurementsAddIn.class, | |
30 | serviceNames.get(0), multiFactory, regKey); | |
31 | else | |
32 | return null; | |
33 | } | |
34 | ||
35 | public boolean staticWriteRegistryServiceInfo(XRegistryKey regKey) { | |
36 | boolean success = true; | |
37 | for (String srv : serviceNames) | |
38 | success &= FactoryHelper.writeRegistryServiceInfo( | |
39 | implementationName, srv, regKey); | |
40 | return success; | |
41 | } | |
42 | } |