bump product version to 4.2.0.1
[LibreOffice.git] / qadevOOo / testdocs / qadevlibs / source / test / Job.java
blob53f7c30047e140d026554d1067c5c3b0917af297
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 .
18 package test;
20 import com.sun.star.task.XJob;
21 import com.sun.star.lang.XSingleServiceFactory;
22 import com.sun.star.beans.*;
23 import com.sun.star.container.*;
24 import com.sun.star.lang.XServiceInfo;
25 import com.sun.star.lang.XTypeProvider;
26 import com.sun.star.uno.Type;
27 import com.sun.star.lang.XMultiServiceFactory;
28 import com.sun.star.registry.XRegistryKey;
29 import com.sun.star.comp.loader.FactoryHelper;
32 public class Job {
34 static public class _Implementation implements XServiceInfo, XTypeProvider,
35 XJob, XNamed {
36 static private final String __serviceName = "test.Job";
37 Object oDoc = null;
38 String actionType = null;
39 String actionParm = null;
40 XMultiServiceFactory oMSF = null;
43 public _Implementation(XMultiServiceFactory xMSF) {
44 oMSF = xMSF;
47 // XServiceInfo
48 public String getImplementationName() throws com.sun.star.uno.RuntimeException {
49 return getClass().getName();
52 public boolean supportsService(String serviceName) throws com.sun.star.uno.RuntimeException {
53 return __serviceName.equals(serviceName);
56 public String[] getSupportedServiceNames() throws com.sun.star.uno.RuntimeException {
57 return new String[] {__serviceName};
60 public static int executed = 0;
61 public Object execute(NamedValue[] args) {
62 executed++;
64 return null;
67 public String getName() {
68 return "" + executed;
71 public void setName(String n) {
74 public byte[] getImplementationId() {
75 return toString().getBytes();
78 public Type[] getTypes() {
79 Class<?> interfaces[] = getClass().getInterfaces();
80 Type types[] = new Type[interfaces.length];
81 for(int i = 0; i < interfaces.length; ++ i)
82 types[i] = new Type(interfaces[i]);
83 return types;
88 public static XSingleServiceFactory __getServiceFactory(String implName,
89 XMultiServiceFactory multiFactory,
90 XRegistryKey regKey) {
91 XSingleServiceFactory xSingleServiceFactory = null;
92 xSingleServiceFactory = FactoryHelper.getServiceFactory(_Implementation.class,
93 _Implementation.__serviceName,
94 multiFactory,
95 regKey);
96 return xSingleServiceFactory;
100 public static boolean __writeRegistryServiceInfo(XRegistryKey regKey) {
101 boolean result = true;
102 result = FactoryHelper.writeRegistryServiceInfo(_Implementation.class.getName(),
103 _Implementation.__serviceName, regKey);
104 return result;