1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Job.java,v $
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 ************************************************************************/
32 import com
.sun
.star
.lang
.XInitialization
;
33 import com
.sun
.star
.task
.XJob
;
34 import com
.sun
.star
.lang
.XSingleServiceFactory
;
35 import com
.sun
.star
.beans
.*;
36 import com
.sun
.star
.container
.*;
37 import com
.sun
.star
.lang
.XServiceInfo
;
38 import com
.sun
.star
.lang
.XTypeProvider
;
39 import com
.sun
.star
.uno
.Type
;
40 import com
.sun
.star
.uno
.Any
;
41 import com
.sun
.star
.frame
.XDispatch
;
42 import com
.sun
.star
.frame
.XDispatchProvider
;
43 import com
.sun
.star
.frame
.XModel
;
44 import com
.sun
.star
.util
.XURLTransformer
;
45 import com
.sun
.star
.frame
.XController
;
46 import com
.sun
.star
.uno
.UnoRuntime
;
47 import com
.sun
.star
.util
.URL
;
48 import com
.sun
.star
.lang
.XMultiServiceFactory
;
50 import com
.sun
.star
.lang
.XComponent
;
51 import lib
.StatusException
;
52 import util
.SOfficeFactory
;
53 import com
.sun
.star
.registry
.XRegistryKey
;
54 import com
.sun
.star
.comp
.loader
.FactoryHelper
;
59 static public class _Implementation
implements XServiceInfo
, XTypeProvider
,
61 static private final String __serviceName
= "test.Job";
63 String actionType
= null;
64 String actionParm
= null;
65 XMultiServiceFactory oMSF
= null;
68 public _Implementation(XMultiServiceFactory xMSF
) {
73 public String
getImplementationName() throws com
.sun
.star
.uno
.RuntimeException
{
74 return getClass().getName();
77 public boolean supportsService(String serviceName
) throws com
.sun
.star
.uno
.RuntimeException
{
78 return __serviceName
.equals(serviceName
);
81 public String
[] getSupportedServiceNames() throws com
.sun
.star
.uno
.RuntimeException
{
82 return new String
[] {__serviceName
};
85 public static int executed
= 0;
86 public Object
execute(NamedValue
[] args
) {
92 public String
getName() {
96 public void setName(String n
) {
99 public byte[] getImplementationId() {
100 return toString().getBytes();
103 public Type
[] getTypes() {
104 Class interfaces
[] = getClass().getInterfaces();
105 Type types
[] = new Type
[interfaces
.length
];
106 for(int i
= 0; i
< interfaces
.length
; ++ i
)
107 types
[i
] = new Type(interfaces
[i
]);
113 public static XSingleServiceFactory
__getServiceFactory(String implName
,
114 XMultiServiceFactory multiFactory
,
115 XRegistryKey regKey
) {
116 XSingleServiceFactory xSingleServiceFactory
= null;
117 xSingleServiceFactory
= FactoryHelper
.getServiceFactory(_Implementation
.class,
118 _Implementation
.__serviceName
,
121 return xSingleServiceFactory
;
125 public static boolean __writeRegistryServiceInfo(XRegistryKey regKey
) {
126 boolean result
= true;
127 result
= FactoryHelper
.writeRegistryServiceInfo(_Implementation
.class.getName(),
128 _Implementation
.__serviceName
, regKey
);