01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2005-2006, GeoTools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: */
16: package org.geotools.openoffice;
17:
18: // OpenOffice dependencies
19: import com.sun.star.lang.XSingleServiceFactory;
20: import com.sun.star.lang.XMultiServiceFactory;
21: import com.sun.star.registry.XRegistryKey;
22:
23: /**
24: * The registration of all formulas provided in this package.
25: *
26: * @since 2.2
27: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/extension/openoffice/src/main/java/org/geotools/openoffice/Registration.java $
28: * @version $Id: Registration.java 20771 2006-07-31 12:52:44Z jgarnett $
29: * @author Martin Desruisseaux
30: */
31: public final class Registration {
32: /**
33: * Do not allows instantiation of this class.
34: */
35: private Registration() {
36: }
37:
38: /**
39: * Returns a factory for creating the service.
40: * This method is called by the {@code com.sun.star.comp.loader.JavaLoader}; do not rename!
41: *
42: * @param implementation The name of the implementation for which a service is desired.
43: * @param factories The service manager to be used if needed.
44: * @param registry The registry key
45: * @return A factory for creating the component.
46: */
47: public static XSingleServiceFactory __getServiceFactory(
48: final String implementation,
49: final XMultiServiceFactory factories,
50: final XRegistryKey registry) {
51: XSingleServiceFactory factory;
52: factory = Referencing.__getServiceFactory(implementation,
53: factories, registry);
54: if (factory == null) {
55: factory = Nature.__getServiceFactory(implementation,
56: factories, registry);
57: }
58: return factory;
59: }
60:
61: /**
62: * Writes the service information into the given registry key.
63: * This method is called by the {@code com.sun.star.comp.loader.JavaLoader}; do not rename!
64: *
65: * @param registry The registry key.
66: * @return {@code true} if the operation succeeded.
67: */
68: public static boolean __writeRegistryServiceInfo(
69: final XRegistryKey registry) {
70: return Referencing.__writeRegistryServiceInfo(registry)
71: && Nature.__writeRegistryServiceInfo(registry);
72: }
73: }
|