/************************************************************************* * * The Contents of this file are made available subject to the terms of * either of the GNU Lesser General Public License Version 2.1 * * Sun Microsystems Inc., October, 2000 * * * GNU Lesser General Public License Version 2.1 * ============================================= * Copyright 2000 by Sun Microsystems, Inc. * 901 San Antonio Road, Palo Alto, CA 94303, USA * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License version 2.1, as published by the Free Software Foundation. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * * The Initial Developer of the Original Code is: Sun Microsystems, Inc.. * * Copyright: 2002 by Sun Microsystems, Inc. * * All Rights Reserved. * * Contributor(s): Cedric Bosdonnat * * ************************************************************************/ package org.libreoffice.example.comp; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.LineNumberReader; import java.lang.reflect.Method; import java.util.ArrayList; import com.sun.star.lang.XSingleComponentFactory; import com.sun.star.registry.XRegistryKey; /** * Component main registration class. * *
This class should not be modified.
* * @author Cedric Bosdonnat aka. cedricbosdo * */ public class RegistrationHandler { /** * Get a component factory for the implementations handled by this class. * *This method calls all the methods of the same name from the classes listed
* in the RegistrationHandler.classes
file. This method
* should not be modified.
This method calls all the methods of the same name from the classes listed
* in the RegistrationHandler.classes
file. This method
* should not be modified.
true
if the informations have been successfully written
* to the registry key, false
otherwise.
*/
public static boolean __writeRegistryServiceInfo(XRegistryKey xRegistryKey ) {
Class[] classes = findServicesImplementationClasses();
boolean success = true;
int i = 0;
while (i < classes.length && success) {
Class clazz = classes[i];
try {
Class[] writeTypes = new Class[]{XRegistryKey.class};
Method getFactoryMethod = clazz.getMethod("__writeRegistryServiceInfo", writeTypes);
Object o = getFactoryMethod.invoke(null, xRegistryKey);
success = success && ((Boolean)o).booleanValue();
} catch (Exception e) {
success = false;
e.printStackTrace();
}
i++;
}
return success;
}
/**
* @return all the UNO implementation classes.
*/
private static Class[] findServicesImplementationClasses() {
ArrayList