bump product version to 5.0.4.1
[LibreOffice.git] / jvmaccess / workbench / java / TestComponent.java
blob8e692a73b3f24fc542d14007327b687b213fb31e
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package com.sun.star.comp.jvmaccess.workbench;
21 import com.sun.star.comp.loader.FactoryHelper;
22 import com.sun.star.lang.XMain;
23 import com.sun.star.lang.XMultiServiceFactory;
24 import com.sun.star.lang.XServiceInfo;
25 import com.sun.star.lang.XSingleServiceFactory;
26 import com.sun.star.lang.XTypeProvider;
27 import com.sun.star.registry.XRegistryKey;
28 import com.sun.star.uno.Type;
30 /* Deploy this component with pkgchk, and call it with the Basic program
32 Sub Main
33 dim args$()
34 o = createunoservice("com.sun.star.comp.jvmaccess.workbench.TestComponent")
35 o.run args$()
36 End Sub
38 The name of the context class loader should appear on the console.
41 public final class TestComponent implements XTypeProvider, XServiceInfo, XMain {
42 public Type[] getTypes() {
43 return new Type[] { new Type(XTypeProvider.class),
44 new Type(XServiceInfo.class),
45 new Type(XMain.class) };
48 public byte[] getImplementationId() {
49 return new byte[0];
52 public String getImplementationName() {
53 return getClass().getName();
56 public boolean supportsService(String serviceName) {
57 return serviceName.equals(serviceName);
60 public String[] getSupportedServiceNames() {
61 return new String[] { serviceName };
64 public int run(String[] arguments) {
65 System.out.println("context class loader: "
66 + Thread.currentThread().getContextClassLoader());
67 return 0;
70 public static XSingleServiceFactory __getServiceFactory(
71 String implName, XMultiServiceFactory multiFactory, XRegistryKey regKey)
73 if (implName.equals(TestComponent.class.getName())) {
74 return FactoryHelper.getServiceFactory(TestComponent.class,
75 serviceName, multiFactory,
76 regKey);
77 } else {
78 return null;
82 public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
83 return FactoryHelper.writeRegistryServiceInfo(
84 TestComponent.class.getName(), serviceName, regKey);
87 private static final String serviceName
88 = "com.sun.star.comp.jvmaccess.workbench.TestComponent";