merge the formfield patch from ooo-build
[ooovba.git] / jurt / com / sun / star / comp / loader / JavaLoaderFactory.java
blobe696f00a7d3b3b5ded6c760f07ab5bfd2a2dc395
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: JavaLoaderFactory.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package com.sun.star.comp.loader;
33 import com.sun.star.lang.XSingleServiceFactory;
34 import com.sun.star.lang.XMultiServiceFactory;
35 import com.sun.star.lang.XServiceInfo;
38 public class JavaLoaderFactory implements XSingleServiceFactory, XServiceInfo {
40 private static String[] supportedServices = {
41 "com.sun.star.loader.Java",
42 "com.sun.star.loader.Java2"
45 private static final boolean DEBUG = false;
47 private static final void DEBUG(String dbg) {
48 if (DEBUG)
49 System.err.println(" >>> JavaLoaderFactory - " + dbg);
52 protected XMultiServiceFactory multiServiceFactory = null;
54 /** default constructor
56 // public JavaLoaderFactory() {}
58 public JavaLoaderFactory(XMultiServiceFactory factory) {
59 multiServiceFactory = factory;
62 public java.lang.Object createInstance()
63 throws com.sun.star.uno.Exception,
64 com.sun.star.uno.RuntimeException
66 return new JavaLoader(multiServiceFactory);
69 public java.lang.Object createInstanceWithArguments( java.lang.Object[] args )
70 throws com.sun.star.uno.Exception,
71 com.sun.star.uno.RuntimeException
73 JavaLoader loader = new JavaLoader();
74 loader.initialize(args);
76 return loader;
79 /** implements the XServiceInfo interface
81 public String getImplementationName()
82 throws com.sun.star.uno.RuntimeException
84 return JavaLoader.class.getName();
87 /** implements the XServiceInfo interface
89 public boolean supportsService(String serviceName)
90 throws com.sun.star.uno.RuntimeException
92 for ( int i = 0; i < supportedServices.length; i++ ) {
93 if ( supportedServices[i].equals(serviceName) )
94 return true;
96 return false;
99 /** implements the XServiceInfo interface
101 public String[] getSupportedServiceNames()
102 throws com.sun.star.uno.RuntimeException
104 return supportedServices;