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 import com
.sun
.star
.comp
.loader
.FactoryHelper
;
20 import com
.sun
.star
.lang
.*;
21 import com
.sun
.star
.uno
.*;
22 import com
.sun
.star
.registry
.XRegistryKey
;
27 /** This component implements XTypeProvider for use with StarBasic.
28 * The XServiceInfo is implemented to have an interface in which we can put some
29 * code just for the sake of debugging.
31 * To debug with JPDA (jdk 1.3), put these lines in the java.ini within the [Java] section:
33 * -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=y
35 * When the Virtual Machine service is instantiated it will block until the debugger
36 * attaches to it on port 8000. You can chose a different port. You attach to the VM using
39 * jdb -connect com.sun.jdi.SocketAttach:hostname=myhost,port=8000
41 * myhost is the hostname where the VM is running.
43 public class TestComponent
implements XServiceInfo
, XTypeProvider
45 public static final String __serviceName
="JavaTestComponent";
48 public com
.sun
.star
.uno
.Type
[] getTypes( )
50 Type
[] retValue
= new Type
[2];
51 retValue
[0]= new Type( XServiceInfo
.class);
52 retValue
[1]= new Type( XTypeProvider
.class);
56 public byte[] getImplementationId( )
63 public String
getImplementationName( )
65 // the functions are for debugging
67 // Test security settings
68 File f
= new File("c:/temp/javasecurity.txt");
73 URL url
= new URL("http://localhost:8080/index.html");
76 url
= new URL("http://www.w3.org/index.html");
78 }catch( MalformedURLException mue
) {
79 }catch( IOException e
) {
80 String s
= e
.getMessage();
81 System
.out
.println(s
);
87 public boolean supportsService( /*IN*/String ServiceName
)
94 public String
[] getSupportedServiceNames( )
96 String
[] retValue
= new String
[0];
100 public static XSingleServiceFactory
__getServiceFactory(String implName
,
101 XMultiServiceFactory multiFactory
,
104 XSingleServiceFactory xSingleServiceFactory
= null;
106 if (implName
.equals( TestComponent
.class.getName()) )
107 xSingleServiceFactory
= FactoryHelper
.getServiceFactory( TestComponent
.class,
108 TestComponent
.__serviceName
,
112 return xSingleServiceFactory
;
116 * Writes the service information into the given registry key.
117 * This method is called by the <code>JavaLoader</code>
119 * @return returns true if the operation succeeded
120 * @param regKey the registryKey
121 * @see com.sun.star.comp.loader.JavaLoader
123 public static boolean __writeRegistryServiceInfo(XRegistryKey regKey
)
125 return FactoryHelper
.writeRegistryServiceInfo( TestComponent
.class.getName(),
126 TestComponent
.__serviceName
, regKey
);